Processing of top level forms in the file compiler is defined as follows:
plus .5 fil
CT LT E Mode Action New Mode ---------- Yes Yes --- --- Process compile-time-too No Yes Yes CTT Process compile-time-too No Yes Yes NCT Process not-compile-time No Yes No --- Process not-compile-time Yes No --- --- Evaluate --- No No Yes CTT Evaluate --- No No Yes NCT Discard --- No No No --- Discard ---
■图表 3-7. EVAL-WHEN processing
Column CT indicates whether :compile-toplevel is specified. Column LT indicates whether :load-toplevel is specified. Column E indicates whether :execute is specified. Column Mode indicates the processing mode; a dash (---) indicates that the processing mode is not relevant.
The Action column specifies one of three actions:
The New Mode column indicates the new processing mode. A dash (---) indicates the compiler remains in its current mode.
Note that top level forms are processed in the order in which they textually appear in the file and that each top level form read by the compiler is processed before the next is read. However, the order of processing (including macro expansion) of subforms that are not top level forms and the order of further compilation is unspecified as long as Common Lisp semantics are preserved.
eval-when forms cause compile-time evaluation only at top level. Both :compile-toplevel and :load-toplevel situation specifications are ignored for non-top-level forms. For non-top-level forms, an eval-when specifying the :execute situation is treated as an implicit progn including the forms in the body of the eval-when form; otherwise, the forms in the body are ignored.