Next: Multithread, Previous: Macros, Up: Top
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.
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}*
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)
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
function-name ::= symbol | (setf symbol) method-qualifier ::= non-nil-atom parameter-specializer-name ::= symbol | (eql eql-specializer-form )
function-name ::= symbol | (setf symbol)
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.
method-qualifiers specializers &optional errorp
The generic function function-keywords is used to return the keyword parameter specifiers for a given method.
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 fordefgeneric
. 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.
The generic function
initialize-instance
is called bymake-instance
to initialize a newly created instance. The generic functioninitialize-instance
is called with the new instance and the defaulted initialization arguments.
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.
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.
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.
The generic function method-qualifiers returns a list of the qualifiers of the given method.
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.
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.
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.
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.
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.
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 forinitialize-instance
,reinitialize-instance
,update-instance-for-redefined-class
, andupdate-instance-for-different-class
.
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.
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.
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.
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.
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.
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.
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.
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. Bothsetf
andsetq
can be used to set the value of the slot.