Chapter 2

Syntax

Statements

A statement is a call to a statement macro. It begins with the name of a visible binding whose value is a statement macro. The statement ends with the word end optionally followed by the same name that began the statement. In between is a program fragment whose syntax is determined by the macro definition. Typically this fragment includes an optional body; for example, if (ship.ready?) embark(passenger, ship) end if.

A statement macro can be built-in or user-defined.

A user-defined statement macro is a macro that defines how to implement a statement in terms of other constructs. Advanced programmers often define new statement macros as part of structuring a program in a readable and modular way.

A built-in statement macro is like a user-defined statement macro but is specified as part of the Dylan language. There are nine built-in statement macros: begin, block, case, for, if, select, unless, until, and while.

An implementation can add new kinds of statements as language extensions. Such a statement takes the form of a user-defined statement macro that is the value of a binding exported by an implementation-defined module.