The special form
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
, etc.
(Consult the syntax definition of each special form to see if it takes
declare
forms and/or documentation strings.)
There are two distinct uses of
declare
: one is to declare Lisp variables as "special" (this affects the semantics of the appropriate bindings of the variables), and the other is to provide advice to help the Common Lisp system (in reality the compiler) run your Lisp code faster, or with more sophisticated debugging options.
Note the following LispWorks extensions to the Common Lisp definition of
declare
:
lambda-list
specifies the value to be returned when a programmer asks for the arglist of a function
values
specifies the value to be returned when you ask for a description of the results of a function
invisible-frame
specifies that calls to this function should not appear in a debugger backtrace
alias
specifies that calls to this function should be displayed as calls to an alternative function in a debugger backtrace
If you use
declare
to specify types (and so turn off type-checking for the specified symbols) and then supply the wrong type, you may obtain a "Segmentation Violation". You can check this by interpreting the code (rather than compiling it).