Chapter 2

Syntax


Bindings

A binding is an association of a name with a value. The bindings in a module persist for the life of the program execution. The scope of such a binding is its module. That is, the binding is visible to all source-records in the module. A module can export bindings and can import bindings from other modules. Only an exported binding can be imported. A binding is visible to all source-records in a module that imports it.

A binding may be specialized. This restricts the types of values that may be held in the binding. An error will be signaled on any attempt to initialize or assign the binding to a value that is not of the correct type.

A binding is either constant or variable. A constant (or read-only) binding always has the same value. In contrast, a variable (or writable) binding can have its value changed, using the assignment operator :=. Most bindings in a typical Dylan module are constant.