Previous | Table of Contents | Next |
defgeneric function-name lambda-list {function-option}* (Macro)
defgeneric defines a new generic function or redefines an existing one. defgeneric specifies the generic function interface using the lambda list. The options include documentation, method-combination type, and declarations. There are some variations on defgeneric that I do not describe here: generic-flet, generic-labels, with-added-methods, and generic-function (which defines an anonymous generic function):
function-name Names the generic function using a symbol or a function specification such as (setf symbol). lambda-list Describes the argument list for the generic function. The argument list cannot contain &aux variables. Optional and keyword arguments may not have defaults or use supplied-p parameters. No parameter can be specialized. The options for function-option are
(:argument-precedence-order order {argument-name}+) Arguments are normally evaluated from left to right. This specifies a different for evaluating the arguments in the order supplied. If present, this list must include all required argument names. (declare {declaration}+) The standard Common Lisp declarations can be used, except for declaration, ftype, function, inline, and special. (:documentation string) doc-string is a string that should contain doc- documentation for the generic function. (:generic-function-name) This specifies the class of the generic class function object. The default is standard-generic-function. (:method {qualifier}* specializer-lambda-list {decl | doc}*{form}*) Defines a method for the generic function. This is equivalent to defmethod. (:method-class name This specifies the class of the methods for this generic function. The default is standard-method. (:method-combination symbol {arguments}*) This specifies the method-combination type with name symbol.arguments are the arguments needed by the method-combination type. defmethod name {qualifier}* specializer-lambda-list {decl | doc}* {body}* (Macro)
Returns the method object. defmethod defines a new method for a generic function or redefines an existing method:
name This is the name of the generic function. It is either a symbol or a function specification such as (setf symbol). qualifier This identifies the role of the method. The standard method combination implements method qualifiers :before, :after, and :around. specializer-lambda-list This matches the standard Common Lisp argument list definition except that the name of a required argument can be replaced by a specialized parameter, which is a list of the form (arg specializer-name). Optional arguments cannot be specialized. specializer-name can be a list, for example, (eql form) or a symbol that names a class. Classes can be a user-defined built-in-class or a user-defined defstruct class declared without the :type option. A declaration about the method. A string that should contain documentation for the method. decl A declaration about the method. doc A string that should contain documentation for the method. body The code that implements the method.
describe object (Generic function)
Returns no value. Prints a description of object to standard output. A default primary method uses the standard method combination type.
find-class symbol &optional (errorp t) (Function)
Returns the class object with name symbol. If errorp is t (the default) and there is no class with this name, it signals an error; otherwise, it returns nil. This function works with setf to change the class name to a new symbol.
find-method generic-function qualifiers specializers &optional errorp (Generic function)
Returns the method object associated with the generic function object (which, for example, is returned by symbol-function on a symbol) and its qualifiers and specializers:
qualifiers A list of the method qualifiers (such as :before). specializers A list of the methods argument specializer objects. The list contains one specialization corresponding to each required argument. Arguments that do not have explicit specializations use the specialization class named t. errorp If t (the default), signal an error if there is no method. If nil, return nil if there is no method.
make-instance class &rest initargs (Generic function)
Returns a new instance of class and initializes the slots by calling the generic function initialize-instance with the new instance and the initargs. There is a set of MOP operations that I do not describe here that can be used to customize make-instance (and redefine instances): initialize-instance, reinitialize-instance, shared-initialize, update-instance-for-redefined-class, and update-instance-for-different-class:
initargs Pairs of initarg names and values. The initarg names are defined in the :initarg option to defclass or are the names of keyword parameters defined in the MOP methods for make-instance, initialize-instance, or shared-initialize.
Previous | Table of Contents | Next |