Next: , Previous: Macros, Up: Top


11 CLOS

— Generic: add-method generic-function method
— Method: add-method (
— Macro: call-method method next-method-list
— Macro: call-next-method &rest args
— Generic: change-class instance new-class
— Method: change-class (
— Method: change-class (
— Generic: class-name class
— Method: class-name (
— Generic: (setf class-name) new-value class
— Method: (setf class-name) new-value (class class)
— Function: class-of object

The function class-of returns the class of which the given object is an instance. The argument to class-of may be any Common-Lisp object.

— Function: compute-applicable-methods generic-function function-arguments
— Macro: defclass class-name ({superclass-name}*) ({slot-specifier}*) [class-option]
          class-name ::= symbol
          superclass-name ::= symbol
          slot-specifier ::= slot-name | (slot-name [slot-option])
          slot-name ::= symbol
          slot-option ::= {:reader reader-function-name}*
                  | {:writer writer-function-name}*
                  | {:accessor reader-function-name}*
                  | {:allocation allocation-type}
                  | {:initarg initarg-name}*
                  | {:initform form}
                  | {:type type-specifier}
                  | {:documentation string}
          reader-function-name ::= symbol
          writer-function-name ::= function-name
          function-name ::= symbol |(setf symbol)
          initarg-name ::= symbol
          allocation-type ::= :instance | :class
          class-option ::= (:default-initargs initarg-list)
                  | (:documentation string)
                  | (:metaclass class-name)
          initarg-list ::= {initarg-name default-initial-value-form}*
— Macro: defgeneric function-name lambda-list [option | {method-description}*]
          function-name ::= symbol | (setf symbol)
          lambda-list ::= ({var}*
                  [&optional {var | (var)}*]
                  [&rest var]
                  [&key {keyword-parameter}* [&allow-other-keys]])
          keyword-parameter ::= var | ( {var | (keywordvar )})
          option ::= (:argument-precedence-order {parameter-name}+)
                  | (declare {declaration}+)
                  | (:documentation string)
                  | (:method-combination symbol {arg}*)
                  | (:generic-function-class class-name)
                  | (:method-class class-name)
          method-description ::=
                  (:method {method-qualifier}* specialized-lambda-list
                   [{declaration}* | documentation]
                   {form}*)
          method-qualifier ::= non-nil-atom
          specialized-lambda-list ::= ({var | (var parameter-specializer-name)}*
                  [&optional {var | (var [initform [supplied-p-parameter]])}*]
                  [&rest var]
                  [&key {specialized-keyword-parameter}* [&allow-other-keys]])
                  [&aux {var | (var [initform])}*] )
          specialized-keyword-parameter ::= var
                  | {({var | (keywordvar)} [initform [supplied-p-parameter]])}*
          parameter-specializer-name ::= symbol | (eql eql-specializer-form)
— Macro: define-method-combination name [short-form-option]
— Macro: define-method-combination name lambda-list ({method-group-specifier}*) [(:arguments . lambda-list)] [(:generic-function generic-fn-symbol)] [{declaration}* | doc-string] {form}*
          short-form-option ::= :documentation string
                                  | :identity-with-one-argument boolean
                                  | :operator operator
          method-group-specifier ::= (variable  {qualifier-pattern}+ | predicate
                                  [long-form-option])
          long-form-option ::= :description format-string
                                  | :order order
                                  | :required boolean
— Macro: defmethod function-name {method-qualifier}+ specialized-lambda-list [{declaration}* | doc-string] {form}*
          function-name ::= symbol | (setf symbol)
          method-qualifier ::= non-nil-atom
          parameter-specializer-name ::= symbol | (eql eql-specializer-form )
— Generic: documentation x &optional doc-type
— Method: documentation (
— Method: documentation (
— Method: documentation (
— Method: doumentation (
— Method: documentation (
— Method: documentation (
— Method: documentation (
— Generic: (setf documentation) new-value x &optional doc-type
— Method: (setf documentation) new-value (method standard-method) &optional doc-type
— Method: (setf documentation) new-value (class standard-class) &optional doc-type
— Method: (setf documentation) new-value (method-combination method-combination)
— Method: (setf documentation) new-value (slot-description standard-slot-description) &optional doc-type
— Method: (setf documentation) new-value (symbol symbol) &optional doc-type
— Method: (setf documentation) new-value (list list) &optional doc-type
— Function: ensure-generic-function {function-name &key lambda-list &key :argument-precedence-order :declare :documentation :generic-function-class|ekeys:method-combination :method-class :environment}
          function-name ::= symbol | (setf symbol)
— Function: find-class symbol &optional errorp environment

The function find-class returns the class object named by the given symbol in the given environment. The first argument to find-class is a symbol.

— Generic: find-method generic-function method-qualifiers specializers &optional errorp
— Method: find-method (

method-qualifiers specializers &optional errorp

— Generic: function-keywords method
— Method: function-keywords (

The generic function function-keywords is used to return the keyword parameter specifiers for a given method.

— Macro: generic-function {lambda-list \mchoiceoption | {method-description}*}
          option ::= (:argument-precedence-order {parameter-name}+)
                  | (declare {declaration}+)
                  | (:documentation string)
                  | (:method-combination symbol {arg}*)
                  | (:generic-function-class class-name)
                  | (:method-class class-name)
          method-description ::= (:method {method-qualifier}*
                                          specialized-lambda-list
                                          {declaration | documentation}*
                                          {form}*)

The generic-function macro creates an anonymous generic function. The generic function is created with the set of methods specified by its method descriptions. The option, method-qualifier, and specialized-lambda-list arguments are the same as for defgeneric. The generic function object is returned as the result. If no method descriptions are specified, an anonymous generic function with no methods is created. See defgeneric, generic-flet, generic-labels, defmethod.

— Generic: initialize-instance instance &rest initargs
— Method: initialize-instance (

The generic function initialize-instance is called by make-instance to initialize a newly created instance. The generic function initialize-instance is called with the new instance and the defaulted initialization arguments.

— Function: invalid-method-error method format-string &rest args

The function invalid-method-error is used to signal an error when there is an applicable method whose qualifiers are not valid for the method combination type. The error message is constructed by using a format string and any arguments to it. Because an implementation may need to add additional contextual information to the error message, invalid-method-error should be called only within the dynamic extent of a method combination function. The function invalid-method-error is called automatically when a method fails to satisfy every qualifier pattern and predicate in a define-method-combination form. A method combination function that imposes additional restrictions should call invalid-method-error explicitly if it encounters a method it cannot accept.

— Generic: make-instance class &rest initargs
— Method: make-instance (
— Method: make-instance (

The generic function make-instance creates and returns a new instance of the given class. The generic function make-instance may be used as described in section 1.9. The class argument is a class object or a symbol that names a class. The remaining arguments form a list of alternating initialization argument names and values. If the second of the above methods is selected, that method invokes make-instance on the arguments (find-class class) and initargs. The initialization arguments are checked within make-instance (see section 1.9). The new instance is returned.

— Generic: make-instances-obsolete class
— Method: make-instances-obsolete (
— Method: make-instances-obsolete (
— Function: method-combination-error format-string &rest args

The function method-combination-error is used to signal an error in method combination. The error message is constructed by using a format string and any arguments to it. Because an implementation may need to add additional contextual information to the error message, method-combination-error should be called only within the dynamic extent of a method combination function. The format-string argument is a control string that can be given to format, and args are any arguments required by that string.

— Generic: method-qualifiers method
— Method: method-qualifiers (

The generic function method-qualifiers returns a list of the qualifiers of the given method.

— Function: next-method-p

The locally defined function next-method-p can be used within the body of a method defined by a method-defining form to determine whether a next method exists.

— Generic: no-applicable-method generic-function &rest function-arguments
— Method: no-applicable-method (

The generic function no-applicable-method is called when a generic function of the class standard-generic-function is invoked and no method on that generic function is applicable. The default method signals an error.

— Generic: no-next-method generic-function method &rest args
— Method: no-next-method (
— Generic: print-object object stream
— Method: print-object (

The generic function print-object writes the printed representation of an object to a stream. The function print-object is called by the print system; it should not be called by the user.

— Generic: reinitialize-instance instance &rest initargs
— Method: reinitialize-instance (

The generic function reinitialize-instance can be used to change the values of local slots according to initialization arguments. This generic function is called by the Meta-Object Protocol. It can also be called by users.

— Generic: remove-method generic-function method
— Method: remove-method (

The generic function remove-method removes a method from a generic function. It destructively modifies the specified generic function and returns the modified generic function as its result.

— Generic: shared-initialize instance slot-names &rest initargs
— Method: shared-initialize (

The generic function shared-initialize is used to fill the slots of an instance using initialization arguments and :initform forms. It is called when an instance is created, when an instance is re-initialized, when an instance is updated to conform to a redefined class, and when an instance is updated to conform to a different class. The generic function shared-initialize is called by the system-supplied primary method for initialize-instance, reinitialize-instance, update-instance-for-redefined-class, and update-instance-for-different-class.

— Function: slot-boundp instance slot-name

The function slot-boundp tests whether a specific slot in an instance is bound. The arguments are the instance and the name of the slot.

— Function: slot-exists-p object slot-name

The function slot-exists-p tests whether the specified object has a slot of the given name. The object argument is any object. The slot-name argument is a symbol.

— Function: slot-makunbound instance slot-name

The function slot-makunbound restores a slot in an instance to the unbound state. The arguments to slot-makunbound are the instance and the name of the slot.

— Generic: slot-missing class object slot-name operation &optional new-value
— Method: slot-missing (

The generic function slot-missing is invoked when an attempt is made to access a slot in an object whose metaclass is standard-class and the name of the slot provided is not a name of a slot in that class. The default method signals an error.

— Generic: slot-unbound class instance slot-name
— Method: slot-unbound (

The generic function slot-unbound is called when an unbound slot is read in an instance whose metaclass is standard-class. The default method signals an error.

— Function: slot-value object slot-name

The function slot-value returns the value contained in the slot slot-name of the given object. If there is no slot with that name, slot-missing is called. If the slot is unbound, slot-unbound is called. The macro setf can be used with slot-value to change the value of a slot.

— Generic: update-instance-for-different-class previous current &rest initargs
— Method: update-instance-for-different-class (
— Generic: update-instance-for-redefined-class instance added-slots discarded-slots property-list &rest initargs
— Method: update-instance-for-redefined-class (
— Macro: with-accessors (

The macro with-accessors creates a lexical environment in which specified slots are lexically available through their accessors as if they were variables. The macro with-accessors invokes the appropriate accessors to access the specified slots. Both setf and setq can be used to set the value of the slot. The result returned is that obtained by executing the forms specified by the body argument.

— Macro: with-slots (
          slot-entry ::= slot-name | (variable-name slot-name)

The macro with-slots creates a lexical context for referring to specified slots as though they were variables. Within such a context the value of the slot can be specified by using its slot name, as if it were a lexically bound variable. Both setf and setq can be used to set the value of the slot.