Common Lisp the Language, 2nd Edition

Next: Compilation Environment Up: The Compiler Previous: Compiler Diagnostics

## 25.1.2. Compiled Functions

X3J13 voted in June 1989 (COMPILED-FUNCTION-REQUIREMENTS) to impose certain requirements on the functions produced by the compilation process.

If a function is of type `compiled-function`, then all macro calls appearing lexically within the function have already been expanded and will not be expanded again when the function is called. The process of compilation effectively turns every `macrolet` or `symbol-macrolet` construct into a `progn` (or a `locally`) with all instances of the local macros in the body fully expanded.

If a function is of type `compiled-function`, then all `load-time-value` forms appearing lexically within the function have already been pre-evaluated and will not be evaluated again when the function is called.

Implementations are free to classify every function as a `compiled-function` provided that all functions satisfy the preceding requirements. Conversely, it is permissible for a function that is not a `compiled-function` to satisfy the preceding requirements.

If one or more functions are defined in a file that is compiled with `compile-file` and the compiled file is subsequently loaded by the function `load`, the resulting loaded function definitions must be of type `compiled-function`.

The function `compile` must produce an object of type `compiled-function` as the value that is either returned or stored into the `symbol-function` of a symbol argument.

Note that none of these restrictions addresses questions of the compilation technology or target instruction set. For example, a compiled function does not necessarily consist of native machine instructions. These requirements merely specify the behavior of the type system with respect to certain actions taken by `compile`, `compile-file`, and `load`.

Next: Compilation Environment Up: The Compiler Previous: Compiler Diagnostics