Generic function BUILD-DEFINITION-FORM
Syntax:
build-definition-form what name definition-forms &optional prefix-options => <undefined>
Arguments and Values:
what
---a symbol, or some structured
object, e.g. a cons
name
---a symbol, or some structured
object, e.g. a cons
definition-forms
---a compound form
Description:
Constructs the underlying CL, or other library, definition form based on the arguments received.
The methods of this generic function are called by the DEF macro to perform the eventual expansion of the definition.
The optional parameter prefix-options
can be
used to pass around extra information - usually, but not necessarily, in the form of a
list of symbols - when what
, or
name
is a structured, non-symbol, object.
Examples:
A few simple examples are the following.
- Definitions corresponding to
defvar
,defparameter
, anddefconstant
(defmethod build-definition-form ((what (eql 'var)) (name symbol) definition-forms &optional prefix-options) `(defvar ,name ,@definition-forms))
(defmethod build-definition-form ((what (eql parameter)) (name symbol) definition-forms &optional prefix-options) `(deparameter ,name ,@definition-forms))
(defmethod build-definition-form ((what (eql 'constant)) (name symbol) definition-forms &optional prefix-options) `(defconstant ,name ,@definition-forms))
- The definition for the special indicator
definer
; cfr. the description for DEF.(defmethod build-definition-form ((what (eql 'definer)) (for-what symbol) definition-forms &optional prefix-options) (destructuring-bind ((&key ((:type-of-naming-form name-type) 'symbol) ; Non evaluated ((:name name-var) 'name) ; Non evaluated ((:body-name def-form-var) 'definition-forms) ; Non evaluated ) &body definer-forms) definition-forms `(defmethod build-definition-form ((what (eql ',for-what)) (,name-var ,name-type) ,def-form-var &optional prefix-options) ,@definer-forms)))
Side Effects:
User caused.
Affected By:
None.
Exceptional Situations:
Environment dependent.