3 Optimizing Lisp Programs

3.2 Making declarations

A declaration is a statement that supplies information about a Lisp program to the Lisp environment. With the exception of the special declaration, declarations are optional and are ignored by the interpreter. They can be used to advise the Compiler, however, to produce faster and more efficient code. This applies in particular to type declarations.

You can make declarations with either thedeclare special form or theproclaim function. You can use thedeclare special form to make local declarations within other Common Lisp forms. Local declarations observe the rules of lexical scope. A local declaration has the following form:

(declare declaration-form ...)
You can use theproclaim function to make global declarations. A proclamation is the same thing as a global declaration. A global declaration can be overridden by a local declaration. Note that theproclaim function evaluates its argument, while thedeclare special form does not. A global declaration has the following form:

(proclaim declaration-form)
Liquid Common Lisp provides the following categories of declarations:

arglist
dynamic-extent
ftype
ignore
inline
notinline
optimize
restrictive-ftype
special
type
type-reduce

3.2.1 - SPECIAL declarations
3.2.2 - TYPE declarations
3.2.3 - FTYPE declarations
3.2.4 - RESTRICTIVE-FTYPE declarations
3.2.5 - TYPE-REDUCE declarations
3.2.6 - INLINE and NOTINLINE declarations
3.2.7 - IGNORE declarations
3.2.8 - OPTIMIZE declarations
3.2.9 - ARGLIST declarations
3.2.10 - DYNAMIC-EXTENT declarations

The Advanced User's Guide - 9 SEP 1996

Generated with Harlequin WebMaker