3.3. Declarations [CLHS-3.3]

3.3.1. Declaration SPECIAL
3.3.2. Declaration SAFETY
3.3.3. Declaration (COMPILE)
3.3.4. Declaration SPACE

The declarations (TYPE type variable ...), (FTYPE type function ...), are ignored by both the interpreter and the compiler.

3.3.1. Declaration SPECIAL

Declaration EXT:NOTSPECIALDeclarations (PROCLAIM '(SPECIAL variable)) and DEFCONSTANT are undone by the (PROCLAIM '(EXT:NOTSPECIAL variable)) declaration. This declaration can be used only in global PROCLAIM and DECLAIM forms, not in local DECLARE forms. Of course, you cannot expect miracles: functions compiled before the EXT:NOTSPECIAL proclamation was issued will still be treating variable as special even after the EXT:NOTSPECIAL proclamation.

Function EXT:SPECIAL-VARIABLE-PYou can use the function (EXT:SPECIAL-VARIABLE-P symbol &OPTIONAL environment) to check whether the symbol is a special variable. environment of NIL or omitted means use the global environment. You can also obtain the current lexical environment using the macro EXT:THE-ENVIRONMENT (interpreted code only). This function will always return T for global special variables and constant variables.

3.3.2. Declaration SAFETY

Declaration (OPTIMIZE (SAFETY 3)) results in “safe” compiled code: function calls are never eliminated. This guarantees the semantics described in [ANSI CL] Section 3.5.

3.3.3. Declaration (COMPILE)

The declaration (COMPILE) has the effect that the current form is compiled prior to execution. Examples:

(LOCALLY (DECLARE (compile)) form)

executes a compiled version of form.

(LET ((x 0))
  (FLET ((inc () (DECLARE (compile)) (INCF x))
         (dec () (DECF x)))
    (VALUES #'inc #'dec)))

returns two functions. The first is compiled and increments x, the second is interpreted (slower) and decrements the same x.

The type assertion (THE value-type form) enforces a type check in interpreted code. No type check is done in compiled code. See also the EXT:ETHE macro.

3.3.4. Declaration SPACE

The declaration determines what metadata is recorded in the function object:

SPACE >= 2
documentation string is discarded
SPACE >= 3
the original lambda list is also discarded (most information is still available, see DESCRIBE, but the names of the positional arguments are not).

These notes document CLISP version 2.41Last modified: 2006-10-13