Common Lisp Extension: DEFINER
 

Macro DEF

Syntax:

General form:

  def what name &rest definition-forms
  => <undefined>
  

Special definer form:

  def definer what (&key type-of-naming-form name body-name) &body definer-forms
  => <undefined>
  

Arguments and Values:

Simple DEF form:

what---a symbol, a cons, or the symbol definer

name---a symbol or a cons

definition-forms---a compound form

Special DEF DEFINER form:

what---a symbol, a cons, or the symbol definer

type-of-naming-form---the symbol symbol, or the symbol cons (or some other type specifier); the default is SYMBOL

name---a symbol that is used within the body definer-forms to retrieve the name of the object being defined; the default is the symbol name

body-name---a symbol that is used within the body definer-forms to retrieve the actual definition forms for the definer; the default is the symbol definition-forms

definer-forms---a compound form

Description:

Calls the appropriate CL definition form, or a user definition form built by a specialized call to BUILD-DEFINITION-FORM.

what is a symbol or a cons which directs the underlying form builder code in a method of BUILD-DEFINITION-FORM to produce the appropriate result.

name is a symbol or a cons which can be processed to produce the actual name of the obejct being defined.

The actual contents of definition-forms depend on what is being defined.

Using the definer indicator

what can be the predefined symbol definer. In this case the DEF macro behaves as follows. A BUILD-DEFINITION-FORM method on name is defined. The keyword parameters that can be passed to the DEF are meant to ease the writing of definer-forms.

type-of-naming-form is used in a DECLARE form to aid the compiler. name-var is a symbol that is used within the body definer-forms to retrieve the name of the object being defined. body-name is a symbol that is used within the body definer-forms to retrieve the actual definition forms for the definer.

Examples:

See the main page.

Side Effects:

name is defined as a what in the environment. what is defined depends on the current set of methods for the generic function BUILD-DEFINITION-FORM.

Affected By:

None.

Exceptional Situations:

Environment dependent.