Chapter 2

Syntax

Definitions

A definition is either a call to a user-defined defining macro, a call to a built-in defining macro, or a special definition. Typically, a definition defines a binding in the module containing the definition. Some definitions define more than one binding, and some do not define any bindings.

A user-defined defining macro is a macro that defines a definition in terms of other constructs. A call to a user-defined defining macro always begins with the word define and includes the name of the defining macro. This name when suffixed by -definer is the name of a visible binding whose value is the defining macro. The rest of the syntax of a call to a user-defined defining macro is determined by the particular macro. Some definitions include a body. Advanced programmers often define new defining macros as part of structuring a program in a readable and modular way.

A built-in defining macro is like a user-defined defining macro but is specified as part of the Dylan language. There are eight built-in defining macros: define class, define constant, define generic, define domain, define library, define method, define module, and define variable.

A special definition is a definition construct that is built into the grammar of Dylan. There is only one special definition: define macro.

An implementation can add new kinds of definitions as language extensions. Such definitions may be implemented as special definitions. However, they will more commonly take the form of user-defined definition macros that are the values of bindings exported by implementation-defined modules.