All Manuals > LispWorks® User Guide and Reference Manual > 7 Dspecs: Tools for Handling Definitions

7.2 Forms of dspecs

A dspec is one of:

A symbol which is used as a dspec always names a function or a macro.

(setf foo) is a name for a setf function.

Note: nil is not a legal dspec, because it cannot have a function definition. Therefore when a dspec API returns nil, this should be interpreted in the usual way as "not found" or "not applicable".

7.2.1 Canonical dspecs

Internally, dspecs are handled in the canonical form:

(dspec-class primary-name . qualifiers)

where dspec-class in the canonical name of the class, and qualifiers is a proper list. primary-name is typically a symbol, but can be a list (in the case of a setf function) or a string (in the case of a package). The equality for canonical dspecs is equal.

As an example the general form of a defmethod dspec is:

(defmethod name qualifiers (specializer*))
name         ::= symbol | (setf symbol)
qualifiers   ::= qualifier | (qualifier qualifier*)
qualifier    ::= symbol
specializer  ::= symbol | (eql object)

Functions in the dspec API accept non-canonical dspecs. All dspec functions, except dspec:prettify-dspec, find-dspec-locations, name-definition-locations, dspec-definition-locations and find-name-locations return canonical dspecs.

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