9.2 Declaration Specifiers

Here is a list of valid declaration specifiers for use in declare. A construct is said to be “affected” by a declaration if it occurs within the scope of a declaration.

X3J13 voted in January 1989 to remove this interpretation of the function declaration specifier from the language. Instead, a declaration specifier

(function var1 var2 ...)

is to be treated simply as an abbreviation for

(type function var1 var2 ...)

just as for all other symbols appearing in table 4.1.

X3J13 noted that although function appears in table 4.1, the first edition also discussed it explicitly, with a different meaning, without noting whether the differing interpretation was to replace or augment the interpretation regarding table 4.1. Unfortunately there is an ambiguous case: the declaration

(declare (function foo nil string))

can be construed to abbreviate either

(declare (ftype (function () string) foo))

or

(declare (type function foo nil string))

The latter could perhaps be rejected on semantic grounds: it would be an error to declare nil, a constant, to be of type function. In any case, X3J13 determined that the ice was too thin here; the possibility of confusion is not worth the convenience of an abbreviation for ftype declarations. The change also makes the language more consistent.

An implementation is free to support other (implementation-dependent) declaration specifiers as well. On the other hand, a Common Lisp compiler is free to ignore entire classes of declaration specifiers (for example, implementation-dependent declaration specifiers not supported by that compiler’s implementation), except for the declaration declaration specifier. Compiler implementors are encouraged, however, to program the compiler to issue by default a warning if the compiler finds a declaration specifier of a kind it never uses. Such a warning is required in any case if a declaration specifier is not one of those defined above and has not been declared in a declaration declaration.