All Manuals > LispWorks® User Guide and Reference Manual > 9 The Compiler

9.6 Declare, proclaim, and declaim

The special form declare is used for the following independent purposes:

declare behaves computationally as if it is not present (other than to affect the semantics), and is only allowed in certain contexts, such as after the variable list in a let, do, defun and so on. Consult the syntax definition of each special form to see if it accepts declare forms.

For the details, including some LispWorks extensions to Common Lisp, see the reference entry for declare.

The function proclaim parses declarations in a specified list and then puts their semantics and advice into global effect. This can be useful when compiling a file for speedy execution, since a proclamation such as:

(proclaim '(optimize (speed 3) (space 0) (debug 0)))

causes the rest of the file to be compiled with these optimization levels in effect. (A lengthier way to do this is to make appropriate declarations in every function in the file.) Below are some more examples:

(proclaim '(special *fred*))
(proclaim '(type single-float x y z))
(proclaim '(optimize (safety 0) (speed 3)))

Do not forget to quote the argument list if it is a constant list. This form:

(proclaim (special x))

attempts to call function special.

declaim is a macro equivalent to proclaim.

9.6.1 Naming conventions

Exercise caution if you declare or proclaim variables to be special without regard to the naming convention that surrounds their names with asterisks.

LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:19