Chapter 2

Syntax

Top-Level Definitions

Dylan's built-in defining macros and special definitons can only be used at top level. When the expansion of a user-defined macro includes a call to a built-in defining macro or special definition, the user-defined macro also can only be used at top level.

A constituent is at top level if and only if it is a direct constituent of a body, no preceding constituent of that body is a local declaration, and the body is either the body of a source record or the body of a begin statement that is itself a constituent at top level. When a constituent appears inside a call to a macro, whether that constituent is at top level must be determined after macro expansion.

The effect of the above rule is that a constituent at top level is not in the scope of any local declarations, is not subject to any condition handlers other than default handlers, and is not affected by any flow of control constructs such as conditionals and iterations. This restriction enhances the static nature of definitions.