CMUCL has a context-sensitive declaration mechanism which is useful because it allows flexible control of the compilation policy in large systems without requiring changes to the source files. The primary use of this feature is to allow the exported interfaces of a system to be compiled more safely than the system internals. The context used is the name being defined and the kind of definition (function, macro, etc.)
:context-declarations option to
dynamic scope, affecting all compilation done during the evaluation of the
body. The argument to this option should evaluate to a list of lists of the
In the indicated context, the specified declare forms are inserted at the head of each definition. The declare forms for all contexts that match are appended together, with earlier declarations getting precedence over later ones. A simple example:
:context-declarations '((:external (declare (optimize (safety 2)))))
This will cause all functions that are named by external symbols to be
The full syntax of context specs is:
True if the symbol is internal (external) in its home package.
True if the symbol has no home package.
True if the symbol’s home package is in any of the named packages (false if uninterned.)
True if the function doesn’t have any
interesting name (not
:macro is a global
:function is anything else.
:local is a
:global is anything else.
True when any supplied context-spec is true.
True only when all supplied context-specs are true.
True when context-spec is false.
True when the defined
name is one of these names (
True when any of the
patterns is a substring of the name. The name is wrapped with
$’s, so “
$FOO” matches names beginning with