Chapter 2

Syntax

Libraries and Modules

A complete Dylan program consists of one or more libraries. Some of these libraries are written by the programmer, others are supplied by other programmers or by the Dylan implementation. A library is Dylan's unit of separate compilation and optimization. The libraries that compose a program can be linked together as early as during compilation or as late as while the program is running. Program structure inside of a library is static and does not change after compilation. However, many Dylan implementations provide an incremental compilation feature that allows a library under development to be modified, while the program is running, by modifying and recompiling portions of the library.

A library contains one or more modules. A module is Dylan's unit of global name scoping, and thus of modularity and information hiding. A module can be exported from its library; otherwise it is internal to that library. A library can import modules from other libraries. Only an exported module can be imported.

A module contains zero or more source records and a set of bindings.

A source record is an implementation-defined unit of source program text. For example, in a file-based development environment each source file might be one source record. As another example, in an interactive Dylan interpreter each executable unit of programmer input would be a source record. The source program text in a source record is a body, a grammatical element used in several places in Dylan.