add-dependent

Generic Function add-dependent

metaobject dependent => unspecified

Arguments and Values

  • metaobject -- A class or a generic function metaobject.
  • dependent -- An object.

Arguments

The metaobject argument is a class or generic function metaobject.

The dependent argument is an object.

Values

The value returned by this generic function is unspecified.

Description

This generic function adds dependent to the dependents of metaobject. If dependent is already in the set of dependents it is not added again (no error is signaled).

The generic function map-dependents can be called to access the set of dependents of a class or generic function. The generic function remove-dependent can be called to remove an object from the set of dependents of a class or generic function. The effect of calling add-dependent or remove-dependent while a call to map-dependents on the same class or generic function is in progress is unspecified.

The situations in which add-dependent is called are not specified.

Methods

Remarks

See the Dependent Maintenance Protocol section for remarks about the use of this facility.

add-direct-method

Generic Function add-direct-method

specializer method => unspecified

Arguments and Values

  • specializer -- A specializer metaobject.
  • method -- A method metaobject.

Arguments

The specializer argument is a specializer metaobject.

The method argument is a method metaobject.

Values

The value returned by this generic function is unspecified.

Description

This generic function is called to maintain a set of backpointers from a specializer to the set of methods specialized to it. If method is already in the set, it is not added again (no error is signaled).

This set can be accessed as a list by calling the generic function specializer-direct-methods. Methods are removed from the set by remove-direct-method.

The generic function add-direct-method is called by add-method whenever a method is added to a generic function. It is called once for each of the specializers of the method. Note that in cases where a specializer appears more than once in the specializers of a method, this generic function will be called more than once with the same specializer as argument.

The results are undefined if the specializer argument is not one of the specializers of the method argument.

Methods

Method add-direct-method

(specializer class) (method method) => unspecified

Description

This method implements the behavior of the generic function for class specializers. No behavior is specified for this method beyond that which is specified for the generic function.

This method cannot be overridden unless the following methods are overridden as well:

Method add-direct-method

(specializer eql-specializer) (method method) => unspecified

Description

This method implements the behavior of the generic function for eql specializers. No behavior is specified for this method beyond that which is specified for the generic function.

add-direct-subclass

Generic Function add-direct-subclass

superclass subclass => unspecified

Arguments and Values

  • superclass -- A class metaobject.
  • subclass -- A class metaobject.

Arguments

The superclass argument is a class metaobject.

The subclass argument is a class metaobject.

Values

The value returned by this generic function is unspecified.

Description

This generic function is called to maintain a set of backpointers from a class to its direct subclasses. This generic function adds subclass to the set of direct subclasses of superclass.

When a class is initialized, this generic function is called once for each direct superclass of the class.

When a class is reinitialized, this generic function is called once for each added direct superclass of the class. The generic function remove-direct-subclass is called once for each deleted direct superclass of the class.

Methods

add-method

Generic Function add-method

generic-function method => generic-function

Arguments and Values

  • generic-function -- A generic function metaobject.
  • method -- A method metaobject.

Arguments

The generic-function argument is a generic function metaobject.

The method argument is a method metaobject.

Values

The generic-function argument is returned.

Description

This generic function associates an unattached method with a generic function.

An error is signaled if the lambda list of the method is not congruent with the lambda list of the generic function. An error is also signaled if the method is already associated with some other generic function.

If the given method agrees with an existing method of the generic function on parameter specializers and qualifiers, the existing method is removed by calling remove-method before the new method is added. See the section of the CLOS Specification called Agreement on Parameter Specializers and Qualifiers for a definition of agreement in this context.

Associating the method with the generic function then proceeds in four steps:

  1. add method to the set returned by generic-function-methods and arrange for method-generic-function to return generic-function;
  2. call add-direct-method for each of the method's specializers;
  3. call compute-discriminating-function and install its result with set-funcallable-instance-function; and
  4. update the dependents of the generic function.

The generic function add-method can be called by the user or the implementation.

Methods

Method add-method

(generic-function standard-generic-function) (method standard-method) => generic-function

Description

No behavior is specified for this method beyond that which is specified for the generic function.

allocate-instance

Generic Function allocate-instance

class &rest initargs => instance

Arguments and Values

  • class -- A class metaobject.
  • initargs -- A list of alternating initialization argument names and values.
  • instance -- A newly allocated instance of class.

Arguments

The class argument is a class metaobject.

The initargs argument consists of alternating initialization argument names and values.

Values

The value returned is a newly allocated instance of class.

Description

This generic function is called to create a new, uninitialized instance of a class. The interpretation of the concept of an uninitialized instance depends on the class metaobject class.

Before allocating the new instance, class-finalized-p is called to see if class has been finalized. If it has not been finalized, finalize-inheritance is called before the new instance is allocated.

Methods

Method allocate-instance

(class standard-class) &rest initargs => instance

Description

This method allocates storage in the instance for each slot with allocation :instance. These slots are unbound. Slots with any other allocation are ignored by this method (no error is signaled).

Method allocate-instance

(class funcallable-standard-class) &rest initargs => instance

Description

This method allocates storage in the instance for each slot with allocation :instance. These slots are unbound. Slots with any other allocation are ignored by this method (no error is signaled).

The funcallable instance function of the instance is undefined --- the results are undefined if the instance is applied to arguments before set-funcallable-instance-function has been used to set the funcallable instance function.

Method allocate-instance

(class built-in-class) &rest initargs => |

Description

This method signals an error.

Robert Strandh remarks:

See also the description of this function in the Common Lisp HyperSpec.

The description above suggests that allocate-instance checks to see whether the class is finalized and if not, calls finalize-inheritance. However, the initargs passed to allocate-instance should be the defaulted initargs, and computing those initargs requires the class to be finalized. Therefore, finalize-inheritance must be called before allocate-instance is called. Peeking at PCL source confirms that finalize-inheritance is called from make-instance before allocate-instance is called.

Readers for Class Metaobjects

Readers for Class Metaobjects » Introduction

In this and the immediately following sections, the "reader" generic functions which simply return information associated with a particular kind of metaobject are presented together. General information is presented first, followed by a description of the purpose of each, and ending with the specified methods for these generic functions.

The reader generic functions which simply return information associated with class generic function method slot definition metaobjects are presented together in this section here in the format described under Readers for Class Metaobjects.

Each of the reader generic functions for class generic function method slot definition metaobjects has the same syntax, accepting one required argument called class generic-function method slot, which must be a class generic function method slot definition metaobject; otherwise, an error is signaled. An error is also signaled if the class generic function method slot definition metaobject has not been initialized.

These generic functions can be called by the user or the implementation.

For any of these generic functions which returns a list, such lists will not be mutated by the implementation. The results are undefined if a portable program allows such a list to be mutated.

Readers for Class Metaobjects » Readers

Readers for Class Metaobjects » ... » class-default-initargs

Generic Function class-default-initargs

class => initargs

Description

Returns a list of the default initialization arguments for class. Each element of this list is a canonicalized default initialization argument. The empty list is returned if class has no default initialization arguments.

During finalization finalize-inheritance calls compute-default-initargs to compute the default initialization arguments for the class. That value is associated with the class metaobject and is returned by class-default-initargs.

This generic function signals an error if class has not been finalized.

Generated

Method class-default-initargs

(class built-in-class) => default-initargs

Description

4. This method returns the empty list.

Readers for Class Metaobjects » ... » class-direct-default-initargs

Generic Function class-direct-default-initargs

class => initargs

Description

Returns a list of the direct default initialization arguments for class. Each element of this list is a canonicalized default initialization argument. The empty list is returned if class has no direct default initialization arguments. This is the defaulted value of the :direct-default-initargs initialization argument that was associated with the class during initialization or reinitialization.

Generated

Method class-direct-default-initargs

(class standard-class) => direct-default-initargs

or

(class funcallable-standard-class) => direct-default-initargs

Description

1. This method returns the value which was associated with the class metaobject during initialization or reinitialization.

Method class-direct-default-initargs

(class forward-referenced-class) => direct-default-initargs

or

(class built-in-class) => direct-default-initargs

Description

4. This method returns the empty list.

Readers for Class Metaobjects » ... » class-direct-slots

Generic Function class-direct-slots

class => direct-slots

Description

Returns a set of the direct slots of class. The elements of this set are direct slot definition metaobjects. If the class has no direct slots, the empty set is returned. This is the defaulted value of the :direct-slots initialization argument that was associated with the class during initialization and reinitialization.

Generated

Method class-direct-slots

(class standard-class) => direct-slots

or

(class funcallable-standard-class) => direct-slots

Description

1. This method returns the value which was associated with the class metaobject during initialization or reinitialization.

Readers for Class Metaobjects » ... » class-direct-subclasses

Generic Function class-direct-subclasses

class => subclasses

Description

Returns a set of the direct subclasses of class. The elements of this set are class metaobjects that all mention this class among their direct superclasses. The empty set is returned if class has no direct subclasses. This value is maintained by the generic functions add-direct-subclass and remove-direct-subclass.

Generated

Readers for Class Metaobjects » ... » class-direct-superclasses

Generic Function class-direct-superclasses

class => superclasses

Description

Returns a list of the direct superclasses of class. The elements of this list are class metaobjects. The empty list is returned if class has no direct superclasses. This is the defaulted value of the :direct-superclasses initialization argument that was associated with the class during initialization or reinitialization.

Generated

Method class-direct-superclasses

(class standard-class) => direct-superclasses

or

(class funcallable-standard-class) => direct-superclasses

Description

1. This method returns the value which was associated with the class metaobject during initialization or reinitialization.

Method class-direct-superclasses

(class forward-referenced-class) => direct-superclasses

Description

4. This method returns the empty list.

Readers for Class Metaobjects » ... » class-finalized-p

Generic Function class-finalized-p

class => finalized-p

Description

Returns true if class has been finalized. Returns false otherwise. Also returns false if the class has not been initialized.

Generated

Method class-finalized-p

(class built-in-class) => finalized-p

Description

5. This method returns true.

Readers for Class Metaobjects » ... » class-name

Generic Function class-name

class => name

Description

Returns the name of class. This value can be any Lisp object, but is usually a symbol, or nil if the class has no name. This is the defaulted value of the :name initialization argument that was associated with the class during initialization or reinitialization. (Also see (setf class-name).)

Generated

Method class-name

(class built-in-class) => name

Description

8. This method returns the name of the built-in class.

Readers for Class Metaobjects » ... » class-precedence-list

Generic Function class-precedence-list

class => precedence-list

Description

Returns the class precedence list of class. The elements of this list are class metaobjects.

During class finalization finalize-inheritance calls compute-class-precedence-list to compute the class precedence list of the class.
That value is associated with the class metaobject and is returned by class-precedence-list.

This generic function signals an error if class has not been finalized.

Generated

Readers for Class Metaobjects » ... » class-prototype

Generic Function class-prototype

class => prototype-instance

Description

Returns a prototype instance of class. Whether the instance is initialized is not specified. The results are undefined if a portable program modifies the binding of any slot of prototype instance.

This generic function signals an error if class has not been finalized.

Generated

Readers for Class Metaobjects » ... » class-slots

Generic Function class-slots

class => slots

Description

Returns a possibly empty set of the slots accessible in instances of class. The elements of this set are effective slot definition metaobjects.

During class finalization finalize-inheritance calls compute-slots to compute the slots of the class. That value is associated with the class metaobject and is returned by class-slots.

This generic function signals an error if class has not been finalized.

Generated

Method class-slots

(class built-in-class) => slots

Description

4. This method returns the empty list.

Readers for Class Metaobjects » Methods

The specified methods for the class metaobject reader generic functions are presented below.

Each entry in the table indicates a method on one of the reader generic functions, specialized to a specified class. The number in each entry is a reference to the full description of the method. The full descriptions appear after the table.

  1. This method returns the value which was associated with the class metaobject during initialization or reinitialization.
  2. This method returns the value associated with the class metaobject by finalize-inheritance (class standard-class) or finalize-inheritance (class funcallable-standard-class).
  3. This method signals an error.
  4. This method returns the empty list.
  5. This method returns true.
  6. This method returns false.
  7. This method returns a value derived from the information in Table 5.1, except that implementation-specific modifications are permitted as described in section Implementation and User Specialization.
  8. This method returns the name of the built-in class.
  9. This method returns a value which is maintained by add-direct-subclass (superclass class) (subclass class) and remove-direct-subclass (superclass class) (subclass class). This method can be overridden only if those methods are overridden as well.
  10. No behavior is specified for this method beyond that specified for the generic function.

Robert Strandh remarks: It is not clear what is meant by the phrase Each entry in the table indicates a method on one of the reader generic functions above. It clearly does not mean that each number represents one method, because the same number appears in different rows of the table. One interpretation is that there are exactly 30 methods, but this can not be the case because the specification does not mention a common superclass for standard-class and funcallable-standard-class, so there can not be a single method for the two. Another interpretation, then, is that there are exactly 40 methods. However, in other parts of the document, there is mention of a single method specialized for class that does not correspond to the table above.

compute-applicable-methods

Generic Function compute-applicable-methods

generic-function arguments => methods

Arguments and Values

  • generic-function -- A generic function metaobject.
  • arguments -- A list of objects.
  • methods -- A (possibly empty) list of method metaobjects.

Arguments

The generic-function argument is a generic function metaobject.

The arguments argument is a list of objects.

Values

This generic function returns a possibly empty list of method metaobjects.

Description

This generic function determines the method applicability of a generic function given a list of required arguments. The returned list of method metaobjects is sorted by precedence order with the most specific method appearing first. If no methods are applicable to the supplied arguments the empty list is returned.

When a generic function is invoked, the discriminating function must determine the ordered list of methods applicable to the arguments. Depending on the generic function and the arguments, this is done in one of three ways: using a memoized value; calling compute-applicable-methods-using-classes; or calling compute-applicable-methods. (Refer to the description of compute-discriminating-function for the details of this process.)

The arguments argument is permitted to contain more elements than the generic function accepts required arguments; in these cases the extra arguments will be ignored. An error is signaled if arguments contains fewer elements than the generic function accepts required arguments.

The list returned by this generic function will not be mutated by the implementation. The results are undefined if a portable program mutates the list returned by this generic function.

Methods

Method compute-applicable-methods

(generic-function standard-generic-function) arguments => methods

Description

This method signals an error if any method of the generic function has a specializer which is neither a class metaobject nor an eql specializer metaobject.

Otherwise, this method computes the sorted list of applicable methods according to the rules described in the section of the CLOS Specification called Method Selection and Combination.

This method can be overridden. Because of the consistency requirements between this generic function and compute-applicable-methods-using-classes, doing so may require also overriding compute-applicable-methods-using-classes (standard-generic-function t).

compute-applicable-methods-using-classes

Generic Function compute-applicable-methods-using-classes

generic-function classes => methods ok

Arguments and Values

  • generic-function -- A generic function metaobject.
  • classes -- A list of class metaobjects.
  • methods -- A (possibly empty) list of method metaobjects.
  • ok -- A generalized boolean.

Arguments

The generic-function argument is a generic function metaobject.

The classes argument is a list of class metaobjects.

Values

This generic function returns two values. The first is a possibly empty list of method metaobjects. The second is either true or false.

Description

This generic function is called to attempt to determine the method applicability of a generic function given only the classes of the required arguments.

If it is possible to completely determine the ordered list of applicable methods based only on the supplied classes, this generic function returns that list as its first value and true as its second value. The returned list of method metaobjects is sorted by precedence order, the most specific method coming first. If no methods are applicable to arguments with the specified classes, the empty list and true are returned.

If it is not possible to completely determine the ordered list of applicable methods based only on the supplied classes, this generic function returns an unspecified first value and false as its second value.

When a generic function is invoked, the discriminating function must determine the ordered list of methods applicable to the arguments. Depending on the generic function and the arguments, this is done in one of three ways: using a memoized value; calling compute-applicable-methods-using-classes or calling compute-applicable-methods. (Refer to the description of compute-discriminating-function for the details of this process.)

The following consistency relationship between compute-applicable-methods-using-classes and compute-applicable-methods must be maintained: for any given generic function and set of arguments, if compute-applicable-methods-using-classes returns a second value of true, the first value must be equal to the value that would be returned by a corresponding call to compute-applicable-methods. The results are undefined if a portable method on either of these generic functions causes this consistency to be violated.

The list returned by this generic function will not be mutated by the implementation. The results are undefined if a portable program mutates the list returned by this generic function.

Methods

Method compute-applicable-methods-using-classes

(generic-function standard-generic-function) classes => methods ok

Description

If any method of the generic function has a specializer which is neither a class metaobject nor an eql specializer metaobject, this method signals an error.

In cases where the generic function has no methods with eql specializers, or has no methods with eql specializers that could be applicable to arguments of the supplied classes, this method returns the ordered list of applicable methods as its first value and true as its second value.

Otherwise this method returns an unspecified first value and false as its second value.

This method can be overridden. Because of the consistency requirements between this generic function and compute-applicable-methods, doing so may require also overriding compute-applicable-methods (standard-generic-function t).

Remarks

This generic function exists to allow user extensions which alter method lookup rules, but which base the new rules only on the classes of the required arguments, to take advantage of the class-based method lookup memoization found in many implementations. (There is of course no requirement for an implementation to provide this optimization.)

Such an extension can be implemented by two methods, one on this generic function and one on compute-applicable-methods. Whenever the user extension is in effect, the first method will return a second value of true. This should allow the implementation to absorb these cases into its own memoization scheme.

To get appropriate performance, other kinds of extensions may require methods on compute-discriminating-function which implement their own memoization scheme.

compute-class-precedence-list

Generic Function compute-class-precedence-list

class => precedence-list

Arguments and Values

  • class -- A class metaobject.
  • precedence-list -- A list of class metaobjects.

Arguments

The class argument is a class metaobject.

Values

The value returned by this generic function is a list of class metaobjects.

Description

This generic-function is called to determine the class precedence list of a class.

The result is a list which contains each of class and its superclasses once and only once. The first element of the list is class and the last element is the class named T.

All methods on this generic function must compute the class precedence list as a function of the ordered direct superclasses of the superclasses of class. The results are undefined if the rules used to compute the class precedence list depend on any other factors.

When a class is finalized, finalize-inheritance calls this generic function and associates the returned value with the class metaobject. The value can then be accessed by calling class-precedence-list.

The list returned by this generic function will not be mutated by the implementation. The results are undefined if a portable program mutates the list returned by this generic function.

Methods

Method compute-class-precedence-list

(class class) => precedence-list

Description

This method computes the class precedence list according to the rules described in the section of the CLOS Specification called Determining the Class Precedence List.

This method signals an error if class or any of its superclasses is a forward referenced class.

This method can be overridden.

compute-default-initargs

Generic Function compute-default-initargs

class => initargs

Arguments and Values

  • class -- A class metaobject.
  • initargs -- A list of canonicalized default initialization arguments.

Arguments

The class argument is a class metaobject.

Values

The value returned by this generic function is a list of canonicalized default initialization arguments.

Description

This generic function is called to determine the default initialization arguments for a class.

The result is a list of canonicalized default initialization arguments, with no duplication among initialization argument names.

All methods on this generic function must compute the default initialization arguments as a function of only: (i) the class precedence list of class, and (ii) the direct default initialization arguments of each class in that list. The results are undefined if the rules used to compute the default initialization arguments depend on any other factors.

When a class is finalized, finalize-inheritance calls this generic function and associates the returned value with the class metaobject. The value can then be accessed by calling class-default-initargs.

The list returned by this generic function will not be mutated by the implementation. The results are undefined if a portable program mutates the list returned by this generic function.

Methods

Method compute-default-initargs

(class standard-class) => initargs

or

(class funcallable-standard-class) => initargs

Description

These methods compute the default initialization arguments according to the rules described in the section of the CLOS Specification called Defaulting of Initialization Arguments.

These methods signal an error if class or any of its superclasses is a forward referenced class.

These methods can be overridden.

Robert Strandh remarks: How can class be a forward referenced class?

compute-discriminating-function

Generic Function compute-discriminating-function

generic-function => function

Arguments and Values

  • generic-function -- A generic function metaobject.
  • function -- A function.

Arguments

The generic-function argument is a generic function metaobject.

Values

The value returned by this generic function is a function.

Description

This generic function is called to determine the discriminating function for a generic function. When a generic function is called, the installed discriminating function is called with the full set of arguments received by the generic function, and must implement the behavior of calling the generic function: determining the ordered set of applicable methods, determining the effective method, and running the effective method.

To determine the ordered set of applicable methods, the discriminating function first calls compute-applicable-methods-using-classes. If compute-applicable-methods-using-classes returns a second value of false, the discriminating function then calls compute-applicable-methods.

When compute-applicable-methods-using-classes returns a second value of true, the discriminating function is permitted to memoize the first returned value as follows. The discriminating function may reuse the list of applicable methods without calling compute-applicable-methods-using-classes again provided that:

  1. the generic function is being called again with required arguments which are instances of the same classes,
  2. the generic function has not been reinitialized,
  3. no method has been added to or removed from the generic function,
  4. for all the specializers of all the generic function's methods which are classes, their class precedence lists have not changed and
  5. for any such memoized value, the class precedence list of the class of each of the required arguments has not changed.

Determination of the effective method is done by calling compute-effective-method. When the effective method is run, each method's function is called, and receives as arguments: (i) a list of the arguments to the generic function, and (ii) whatever other arguments are specified in the call-method form indicating that the method should be called. (See make-method-lambda for more information about how method functions are called.)

The generic function compute-discriminating-function is called, and its result installed, by add-method, remove-method, initialize-instance, and reinitialize-instance.

Methods

Method compute-discriminating-function

(generic-function standard-generic-function) => function

Description

No behavior is specified for this method beyond that specified for the generic function.

This method can be overridden.

Robert Strandh remarks: Since client code is not allowed to define methods on compute-applicable-methods specialized to standard-generic-function, it can be argued that for standard-generic-function, compute-applicable-methods does not have to be called. By relaxing the description of compute-discriminating-function this way, the implementation may also cache results when compute-applicable-methods-using-classes returns nil in its second argument. More generally, whenever some behavior is defined for generic functions when called with only standard classes, since client code is not allowed to alter this behavior in any way, the implementation is often free to choose whatever appropriate implementation technique that has the same affect as the one specified. Notice, however, that any behavior that diverges from what is specified, must not be inherited by client-defined subclasses. Only when arguments are direct instances of specified classes can the implementation arbitrarily choose some other technique. -- Robert Strandh 2017-01-23.

compute-effective-method

Generic Function compute-effective-method

generic-function method-combination methods => effective-method options

Arguments and Values

  • generic-function -- A generic function metaobject.
  • method-combination -- A method combination metaobject.
  • methods -- A list of method metaobjects.
  • effective-method -- An effective method.
  • options -- A list of effective method options.

Arguments

The generic-function argument is a generic function metaobject.

The method-combination argument is a method combination metaobject.

The methods argument is a list of method metaobjects.

Values

This generic function returns two values. The first is an effective method, the second is a list of effective method options.

Description

This generic function is called to determine the effective method from a sorted list of method metaobjects.

An effective method is a form that describes how the applicable methods are to be combined. Inside of effective method forms are call-method forms which indicate that a particular method is to be called. The arguments to the call-method form indicate exactly how the method function of the method should be called. (See make-method-lambda for more details about method functions.)

An effective method option has the same interpretation and syntax as either the :arguments or the :generic-function option in the long form of define-method-combination.

More information about the form and interpretation of effective methods and effective method options can be found under the description of the define-method-combination macro in the CLOS specification.

This generic function can be called by the user or the implementation. It is called by discriminating functions whenever a sorted list of applicable methods must be converted to an effective method.

Methods

Method compute-effective-method

(generic-function standard-generic-function) method-combination methods => effective-method options

Description

This method computes the effective method according to the rules of the method combination type implemented by method-combination.

This method can be overridden.

compute-effective-slot-definition

Generic Function compute-effective-slot-definition

class name direct-slot-definitions => effective-slot-definition

Arguments and Values

  • class -- A class metaobject.
  • name -- A slot name.
  • direct-slot-definitions -- An ordered list of direct slot definition metaobjects. The most specific direct slot definition metaobject appears first in the list.
  • effective-slot-definition -- An effective slot definition metaobject.

Arguments

The class argument is a class metaobject.

The name argument is a slot name.

The direct-slot-definitions argument is an ordered list of direct slot definition metaobjects. The most specific direct slot definition metaobject appears first in the list.

Values

The value returned by this generic function is an effective slot definition metaobject.

Description

This generic function determines the effective slot definition for a slot in a class. It is called by compute-slots once for each slot accessible in instances of class.

This generic function uses the supplied list of direct slot definition metaobjects to compute the inheritance of slot properties for a single slot. The returned effective slot definition represents the result of computing the inheritance. The name of the new effective slot definition is the same as the name of the direct slot definitions supplied.

The class of the effective slot definition metaobject is determined by calling effective-slot-definition-class. The effective slot definition is then created by calling make-instance. The initialization arguments passed in this call to make-instance are used to initialize the new effective slot definition metaobject. See Initialization of Slot Definition Metaobjects for details.

Methods

Method compute-effective-slot-definition

(class standard-class) name direct-slot-definitions => effective-slot-definition

or

(class funcallable-standard-class) name direct-slot-definitions => effective-slot-definition

Description

This method implements the inheritance and defaulting of slot options following the rules described in the Inheritance of Slots and Slot Options section of the CLOS Specification.

This method can be extended, but the value returned by the extending method must be the value returned by this method.

compute-slots

Generic Function compute-slots

class => effective-slot-definitions

Arguments and Values

  • class -- A class metaobject.
  • effective-slot-definitions -- A set of effective slot definition metaobjects.

Arguments

The class argument is a class metaobject.

Values

The value returned is a set of effective slot definition metaobjects.

Description

This generic function computes a set of effective slot definition metaobjects for the class class. The result is a list of effective slot definition metaobjects: one for each slot that will be accessible in instances of class.

This generic function proceeds in 3 steps:

  1. The first step collects the full set of direct slot definitions from the superclasses of class.

  2. The direct slot definitions are then collected into individual lists, one list for each slot name associated with any of the direct slot definitions. The slot names are compared with eql. Each such list is then sorted into class precedence list order. Direct slot definitions coming from classes earlier in the class precedence list of class appear before those coming from classes later in the class precedence list. For each slot name, the generic function compute-effective-slot-definition is called to compute an effective slot definition. The result of compute-slots is a list of these effective slot definitions, in unspecified order.

  3. In the final step, the location for each effective slot definition is set. This is done by specified around-methods; portable methods cannot take over this behavior. For more information on the slot definition locations, see the section Instance Structure Protocol.

The list returned by this generic function will not be mutated by the implementation. The results are undefined if a portable program mutates the list returned by this generic function.

Methods

Method compute-slots

(class standard-class) => effective-slot-definitions

or

(class funcallable-standard-class) => effective-slot-definitions

Description

This method implements the specified behavior of the generic function.

This method can be overridden.

Around-Method compute-slots

(class standard-class) => effective-slot-definitions

or

(class funcallable-standard-class) => effective-slot-definitions

Description

This method implements the specified behavior of computing and storing slot locations.

This method cannot be overridden.

direct-slot-definition-class

(Technically not part of the class finalization protocol.)

Generic Function direct-slot-definition-class

class &rest initargs => slot-definition-class

Arguments and Values

  • class -- A class metaobject.
  • initargs -- A list of initialization arguments and values.
  • slot-definition-class -- A class metaobject which is a subclass of the class direct-slot-definition.

Arguments

The class argument is a class metaobject.

The initargs argument is a list of initialization arguments and values.

Values

The value returned is a subclass of the class direct-slot-definition.

Description

When a class is initialized, each of the canonicalized slot specifications must be converted to a direct slot definition metaobject. This generic function is called to determine the class of that direct slot definition metaobject.

The initargs argument is simply the canonicalized slot specification for the slot.

Methods

effective-slot-definition-class

Generic Function effective-slot-definition-class

class &rest initargs => slot-definition-class

Arguments and Values

  • class -- A class metaobject.
  • initargs -- A list of initialization arguments and values.
  • slot-definition-class -- A class metaobject which is a subclass of the class effective-slot-definition.

Arguments

The class argument is a class metaobject.

The initargs argument is a list of initialization arguments and values.

Values

The value returned is a subclass of the class effective-slot-definition.

Description

This generic function is called by compute-effective-slot-definition to determine the class of the resulting effective slot definition metaobject. The initargs argument is the list of initialization arguments and values that will be passed to make-instance when the effective slot definition metaobject is created.

Methods

ensure-class

Function ensure-class

name &key &allow-other-keys => class

Arguments and Values

  • name -- A symbol.
  • class -- A class metaobject.

Arguments

The name argument is a symbol.

Values

The result is a class metaobject.

Description

Some of the keyword arguments accepted by this function are actually processed by ensure-class-using-class, others are processed during initialization of the class metaobject (as described in the section called Initialization of Class Metaobjects).

This function is called to define or redefine a class with the specified name, and can be called by the user or the implementation. It is the functional equivalent of defclass, and is called by the expansion of the defclass macro.

The behavior of this function is actually implemented by the generic function ensure-class-using-class. When ensure-class is called, it immediately calls ensure-class-using-class and returns that result as its own.

The first argument to ensure-class-using-class is computed as follows:

  • If name names a class (find-class returns a class when called with name) use that class.

  • Otherwise use nil.

The second argument is name. The remaining arguments are the complete set of keyword arguments received by the ensure-class function.

ensure-class-using-class

Generic Function ensure-class-using-class

class name &key :direct-default-initargs :direct-slots :direct-superclasses :name :metaclass &allow-other-keys => resulting-class

Arguments and Values

  • class -- A class metaobject or nil
  • name -- A class name.
  • :metaclass -- A class metaobject class or a class metaobject class name. If this argument is not supplied, it defaults to the class named standard-class. If a class name is supplied, it is interpreted as the class with that name. If a class name is supplied, but there is no such class, an error is signaled.
  • :direct-superclasses -- A list of which each element is a class metaobject or a class name. An error is signaled if this argument is not a proper list.

For the interpretation of additional keyword arguments, see Initialization of Class Metaobjects.

  • resulting-class -- A class metaobject.

Arguments

The class argument is a class metaobject or nil.

The name argument is a class name.

The :metaclass argument is a class metaobject class or a class metaobject class name. If this argument is not supplied, it defaults to the class named standard-class. If a class name is supplied, it is interpreted as the class with that name. If a class name is supplied, but there is no such class, an error is signaled.

The :direct-superclasses argument is a list of which each element is a class metaobject or a class name. An error is signaled if this argument is not a proper list.

For the interpretation of additional keyword arguments, see Initialization of Class Metaobjects.

Values

The result is a class metaobject.

Description

This generic function is called to define or modify the definition of a named class. It is called by the ensure-class function. It can also be called directly.

The first step performed by this generic function is to compute the set of initialization arguments which will be used to create or reinitialize the named class. The initialization arguments are computed from the full set of keyword arguments received by this generic function as follows:

  • The :metaclass argument is not included in the initialization arguments.

  • If the :direct-superclasses argument was received by this generic function, it is converted into a list of class metaobjects. This conversion does not affect the structure of the supplied :direct-superclasses argument. For each element in the :direct-superclasses argument:

    • If the element is a class metaobject, that class metaobject is used.

    • If the element names a class, that class metaobject is used.

    • Otherwise an instance of the class forward-referenced-class is created and used. The proper name of the newly created forward referenced class metaobject is set to name.

  • All other keyword arguments are included directly in the initialization arguments.

If the class argument is nil, a new class metaobject is created by calling the make-instance generic function with the value of the :metaclass argument as its first argument, and the previously computed initialization arguments. The proper name of the newly created class metaobject is set to name. The newly created class metaobject is returned.

If the class argument is a forward referenced class, change-class is called to change its class to the value specified by the :metaclass argument. The class metaobject is then reinitialized with the previously computed initialization arguments. (This is a documented violation of the general constraint that change-class not be used with class metaobjects.)

If the class of the class argument is not the same as the class specified by the :metaclass argument, an error is signaled.

Otherwise, the class metaobject class is redefined by calling the reinitialize-instance generic function with class and the initialization arguments. The class argument is then returned.

Methods

Method ensure-class-using-class

(class class) name &key :metaclass :direct-superclasses &allow-other-keys => resulting-class

Description

This method implements the behavior of the generic function in the case where the class argument is a class.

This method can be overridden.

Method ensure-class-using-class

(class forward-referenced-class) name &key :metaclass :direct-superclasses &allow-other-keys => resulting-class

Description

This method implements the behavior of the generic function in the case where the class argument is a forward referenced class.

Method ensure-class-using-class

(class null) name &key :metaclass :direct-superclasses &allow-other-keys => resulting-class

Description

This method implements the behavior of the generic function in the case where the class argument is nil.

ensure-generic-function

Function ensure-generic-function

function-name &key &allow-other-keys => generic-function

Arguments and Values

  • function-name -- A symbol or a list of the form (setf symbol).
  • generic-function -- A generic function metaobject.

Some of the keyword arguments accepted by this function are actually processed by ensure-generic-function-using-class, others are processed during initialization of the generic function metaobject (as described in the section called Initialization of Generic Function Metaobjects).

Arguments

The function-name argument is a symbol or a list of the form (setf symbol).

Some of the keyword arguments accepted by this function are actually processed by ensure-generic-function-using-class, others are processed during initialization of the generic function metaobject (as described in the section called Initialization of Generic Function Metaobjects).

Values

The result is a generic function metaobject.

Description

This function is called to define a globally named generic function or to specify or modify options and declarations that pertain to a globally named generic function as a whole. It can be called by the user or the implementation.

It is the functional equivalent of defgeneric, and is called by the expansion of the defgeneric and defmethod macros.

The behavior of this function is actually implemented by the generic function ensure-generic-function-using-class. When ensure-generic-function is called, it immediately calls ensure-generic-function-using-class and returns that result as its own.

The first argument to ensure-generic-function-using-class is computed as follows:

  • If function-name names a non-generic function, a macro, or a special form, an error is signaled.

  • If function-name names a generic function, that generic function metaobject is used.

  • Otherwise, nil is used.

The second argument is function-name. The remaining arguments are the complete list of keyword arguments received by ensure-generic-function.

ensure-generic-function-using-class

Generic Function ensure-generic-function-using-class

generic-function function-name &key :argument-precedence-order :declarations :documentation :generic-function-class :lambda-list :method-class :method-combination :name &allow-other-keys => generic-function

Arguments and Values

  • generic-function -- A generic function metaobject or nil.
  • function-name -- A symbol or a list of the form (setf symbol).
  • :generic-function-class -- A class metaobject or a class name. If it is not supplied, it defaults to the class named standard-generic-function. If a class name is supplied, it is interpreted as the class with that name. If a class name is supplied, but there is no such class, an error is signaled.

For the interpretation of additional keyword arguments, see Initialization of Generic Function Metaobjects.

  • generic-function -- A generic function metaobject.

Arguments

The generic-function argument is a generic function metaobject or nil.

The function-name argument is a symbol or a list of the form (setf symbol).

The :generic-function-class argument is a class metaobject or a class name. If it is not supplied, it defaults to the class named standard-generic-function. If a class name is supplied, it is interpreted as the class with that name. If a class name is supplied, but there is no such class, an error is signaled.

For the interpretation of additional keyword arguments, see Initialization of Generic Function Metaobjects.

Values

The result is a generic function metaobject.

Description

The generic function ensure-generic-function-using-class is called to define or modify the definition of a globally named generic function. It is called by the ensure-generic-function function. It can also be called directly.

The first step performed by this generic function is to compute the set of initialization arguments which will be used to create or reinitialize the globally named generic function. These initialization arguments are computed from the full set of keyword arguments received by this generic function as follows:

  • The :generic-function-class argument is not included in the initialization arguments.

  • If the :method-class argument was received by this generic function, it is converted into a class metaobject. This is done by looking up the class name with find-class. If there is no such class, an error is signaled.

  • All other keyword arguments are included directly in the initialization arguments.

If the generic-function argument is nil, an instance of the class specified by the :generic-function-class argument is created by calling make-instance with the previously computed initialization arguments. The function name function-name is set to name the generic function. The newly created generic function metaobject is returned.

If the class of the generic-function argument is not the same as the class specified by the :generic-function-class argument, an error is signaled.

Otherwise the generic function generic-function is redefined by calling the reinitialize-instance generic function with generic-function and the initialization arguments. The generic-function argument is then returned.

Methods

Method ensure-generic-function-using-class

(generic-function generic-function) function-name &key :generic-function-class &allow-other-keys => generic-function

Description

This method implements the behavior of the generic function in the case where function-name names an existing generic function.

This method can be overridden.

Method ensure-generic-function-using-class

(generic-function null) function-name &key :generic-function-class &allow-other-keys => generic-function

Description

This method implements the behavior of the generic function in the case where function-name names no function, generic function, macro or special form.

eql-specializer-object

Function eql-specializer-object

eql-specializer => object

Arguments and Values

  • eql-specializer -- An eql specializer metaobject.
  • object -- An object.

Arguments

The eql-specializer argument is an eql specializer metaobject.

Values

The value returned by this function is an object.

Description

This function returns the object associated with eql-specializer during initialization. The value is guaranteed to be eql to the value originally passed to intern-eql-specializer, but it is not necessarily eq to that value.

This function signals an error if eql-specializer is not an eql specializer.

extract-lambda-list

Function extract-lambda-list

specialized-lambda-list => lambda-list

Arguments and Values

  • specialized-lambda-list -- A specialized lambda list as accepted by defmethod.
  • lambda-list -- An unspecialized lambda list.

Arguments

The specialized-lambda-list argument is a specialized lambda list as accepted by defmethod.

Values

The result is an unspecialized lambda list.

Description

This function takes a specialized lambda list and returns the lambda list with the specializers removed. This is a non-destructive operation. Whether the result shares any structure with the argument is unspecified.

If the specialized-lambda-list argument does not have legal syntax, an error is signaled. This syntax checking does not check the syntax of the actual specializer names, only the syntax of the lambda list and where the specializers appear.

Examples

(extract-lambda-list '((p position)))             ==> (P)

(extract-lambda-list '((p position) x y))         ==> (P X Y)

(extract-lambda-list '(a (b (eql x)) c &rest i))  ==> (A B C &OPTIONAL I)

Robert Strandh remarks: The last example in the previous section is surprising, because there is no explanation for it.

extract-specializer-names

Function extract-specializer-names

specialized-lambda-list => specializer-names

Arguments and Values

  • specialized-lambda-list -- A specialized lambda list as accepted by defmethod.
  • specializer-names -- A list of specializer names.

Arguments

The specialized-lambda-list argument is a specialized lambda list as accepted by defmethod.

Values

The result is a list of specializer names.

Description

This function takes a specialized lambda list and returns its specializer names. This is a non-destructive operation. Whether the result shares structure with the argument is unspecified. The results are undefined if the result of this function is modified.

The result of this function will be a list with a number of elements equal to the number of required arguments in specialized-lambda-list. Specializers are defaulted to the symbol T.

If the specialized-lambda-list argument does not have legal syntax, an error is signaled. This syntax checking does not check the syntax of the actual specializer names, only the syntax of the lambda list and where the specializers appear.

Examples

(extract-specializer-names '((p position)))            ==> (POSITION)

(extract-specializer-names '((p position) x y))        ==> (POSITION T T)

(extract-specializer-names '(a (b (eql x)) c &rest i)) ==> (T (EQL X) T)

finalize-inheritance

Generic Function finalize-inheritance

class => unspecified

Arguments and Values

  • class -- A class metaobject.

Arguments

The class argument is a class metaobject.

Values

The value returned by this generic function is unspecified.

Description

This generic function is called to finalize a class metaobject. This is described in the Section named Class Finalization Protocol.

After finalize-inheritance returns, the class metaobject is finalized and the result of calling class-finalized-p on the class metaobject will be true.

Methods

Method finalize-inheritance

(class standard-class) => unspecified

or

(class funcallable-standard-class) => unspecified

Description

No behavior is specified for these methods beyond that which is specified for the generic function.

find-method-combination

Generic Function find-method-combination

generic-function method-combination-type-name method-combination-options => method-combination

Arguments and Values

  • generic-function -- A generic function metaobject.
  • method-combination-type-name -- A symbol which names a type of method combination.
  • method-combination-options -- A list of arguments to the method combination type.
  • method-combination -- A method combination metaobject.

Arguments

The generic-function argument is a generic function metaobject.

The method-combination-type-name argument is a symbol which names a type of method combination.

The method-combination-options argument is a list of arguments to the method combination type.

Values

The value returned by this generic function is a method combination metaobject.

Description

This generic function is called to determine the method combination object used by a generic function.

Remarks

Further details of method combination metaobjects are not specified.

funcallable-standard-instance-access

Function funcallable-standard-instance-access

instance location => object

Arguments and Values

  • instance -- An object.
  • location -- A slot location.
  • object -- An object.

Arguments

The instance argument is an object.

The location argument is a slot location.

Values

The result of this function is an object.

Description

This function is called to provide direct access to a slot in an instance. By usurping the normal slot lookup protocol, this function is intended to provide highly optimized access to the slots associated with an instance.

The following restrictions apply to the use of this function:

  • The instance argument must be a funcallable instance (it must have been returned by allocate-instance (class funcallable-standard-class)).

  • The instance argument cannot be an non-updated obsolete instance.

  • The location argument must be a location of one of the directly accessible slots of the instance's class.

  • The slot must be bound.

The results are undefined if any of these restrictions are not met.

Readers for Generic Function Metaobjects

Readers for Generic Function Metaobjects » Introduction

In this and the immediately following sections, the "reader" generic functions which simply return information associated with a particular kind of metaobject are presented together. General information is presented first, followed by a description of the purpose of each, and ending with the specified methods for these generic functions.

The reader generic functions which simply return information associated with class generic function method slot definition metaobjects are presented together in this section here in the format described under Readers for Class Metaobjects.

Each of the reader generic functions for class generic function method slot definition metaobjects has the same syntax, accepting one required argument called class generic-function method slot, which must be a class generic function method slot definition metaobject; otherwise, an error is signaled. An error is also signaled if the class generic function method slot definition metaobject has not been initialized.

These generic functions can be called by the user or the implementation.

For any of these generic functions which returns a list, such lists will not be mutated by the implementation. The results are undefined if a portable program allows such a list to be mutated.

Readers for Generic Function Metaobjects » Readers

Readers for Generic Function Metaobjects » ... » generic-function-argument-precedence-order

Generic Function generic-function-argument-precedence-order

generic-function => symbols

Description

Returns the argument precedence order of the generic function. This value is a list of symbols, a permutation of the required parameters in the lambda list of the generic function. This is the defaulted value of the :argument-precedence-order initialization argument that was associated with the generic function metaobject during initialization or reinitialization.

Generated

Method generic-function-argument-precedence-order

(generic-function standard-generic-function) => symbols

Description

No behavior is specified for this method beyond that which is specified for the corresponding generic function.

Readers for Generic Function Metaobjects » ... » generic-function-declarations

Generic Function generic-function-declarations

generic-function => list

Description

Returns a possibly empty list of the declarations of the generic function. The elements of this list are declarations. This list is the defaulted value of the :declarations initialization argument that was associated with the generic function metaobject during initialization or reinitialization.

Generated

Method generic-function-declarations

(generic-function standard-generic-function) => list

Description

No behavior is specified for this method beyond that which is specified for the corresponding generic function.

Readers for Generic Function Metaobjects » ... » generic-function-lambda-list

Generic Function generic-function-lambda-list

generic-function => lambda-list

Description

Returns the lambda list of the generic function. This is the defaulted value of the :lambda-list initialization argument that was associated with the generic function metaobject during initialization or reinitialization. An error is signaled if the lambda list has yet to be supplied.

Generated

Method generic-function-lambda-list

(generic-function standard-generic-function) => lambda-list

Description

No behavior is specified for this method beyond that which is specified for the corresponding generic function.

Readers for Generic Function Metaobjects » ... » generic-function-method-class

Generic Function generic-function-method-class

generic-function => class

Description

Returns the default method class of the generic function. This class must be a subclass of the class method. This is the defaulted value of the :method-class initialization argument that was associated with the generic function metaobject during initialization or reinitialization.

Generated

Method generic-function-method-class

(generic-function standard-generic-function) => class

Description

No behavior is specified for this method beyond that which is specified for the corresponding generic function.

Readers for Generic Function Metaobjects » ... » generic-function-method-combination

Generic Function generic-function-method-combination

generic-function => method-combination

Description

Returns the method combination of the generic function. This is a method combination metaobject. This is the defaulted value of the :method-combination initialization argument that was associated with the generic function metaobject during initialization or reinitialization.

Generated

Method generic-function-method-combination

(generic-function standard-generic-function) => method-combination

Description

No behavior is specified for this method beyond that which is specified for the corresponding generic function.

Readers for Generic Function Metaobjects » ... » generic-function-methods

Generic Function generic-function-methods

generic-function => list

Description

Returns the set of methods currently connected to the generic function. This is a set of method metaobjects. This value is maintained by the generic functions add-method and remove-method.

Generated

Readers for Generic Function Metaobjects » ... » generic-function-name

Generic Function generic-function-name

generic-function => name

Description

Returns the name of the generic function, or nil if the generic function has no name. This is the defaulted value of the :name initialization argument that was associated with the generic function metaobject during initialization or reinitialization. (Also see (setf generic-function-name).)

Generated

Method generic-function-name

(generic-function standard-generic-function) => name

Description

No behavior is specified for this method beyond that which is specified for the corresponding generic function.

Readers for Generic Function Metaobjects » Methods

The specified methods for the generic function metaobject reader generic functions are presented below.

(generic-function standard-generic-function) => result

No behavior is specified for these methods beyond that which is specified for their respective generic functions.

[Initialization]

Initialization » Initialization of Class Metaobjects

... » Initialization of Class Metaobjects » Introduction

A class generic function method slot definition metaobject can be created by calling make-instance. The initialization arguments establish the definition of the class generic function method slot definition. A class generic function method slot definition metaobject can be redefined by calling reinitialize-instance. Some classes of class generic function metaobject do not support redefinition; in these cases, cannot be redefined; calling reinitialize-instance signals an error.

Initialization of a class generic function method slot definition metaobject must be done by calling make-instance and allowing it to call initialize-instance. Reinitialization of a class generic function metaobject must be done by calling reinitialize-instance. Portable programs must not call initialize-instance directly to initialize a class generic function method slot definition metaobject. Portable programs must not call shared-initialize directly to initialize or reinitialize a class generic function method slot definition metaobject. Portable programs must not call change-class to change the class of any class generic function method slot definition metaobject or to turn a non-class non-generic-function non-method non-slot-definition object into a class generic function method slot definition metaobject.

Since metaobject classes may not be redefined, no behavior is specified for the result of calls to update-instance-for-redefined-class on class generic function method slot definition metaobjects. Since the class of a class generic function method slot definition metaobject cannot be changed, no behavior is specified for the result of calls to update-instance-for-different-class on class generic function method slot definition metaobjects.

During initialization or reinitialization, each initialization argument is checked for errors and then associated with the class generic function method slot definition metaobject. The value can then be accessed by calling the appropriate accessor as shown in Table 6.1 Table 6.2 Table 6.3 Table 6.4.

This section begins with a description of the error checking and processing of each initialization argument. This is followed by a table showing the generic functions that can be used to access the stored initialization arguments. Initialization behavior specific to the different specified class metaobject classes comes next. The section ends with a set of restrictions on portable methods affecting class generic function method metaobject initialization and reinitialization.

In these descriptions, the phrase this argument defaults to value means that when that initialization argument is not supplied, initialization or reinitialization is performed as if value had been supplied. For some initialization arguments this could be done by the use of default initialization arguments, but whether it is done this way is not specified. Implementations are free to define default initialization arguments for specified class generic function method slot definition metaobject classes. Portable programs are free to define default initialization arguments for portable subclasses of the class class generic-function method slot-definition.

Unless there is a specific note to the contrary, then during reinitialization, if an initialization argument is not supplied, the previously stored value is left unchanged.

... » Initialization of Class Metaobjects » Initargs

  • The :direct-default-initargs argument is a list of canonicalized default initialization arguments.

    An error is signaled if this value is not a proper list, or if any element of the list is not a canonicalized default initialization argument.

    If the class metaobject is being initialized, this argument defaults to the empty list.

  • The :direct-slots argument is a list of canonicalized slot specifications.

    An error is signaled if this value is not a proper list or if any element of the list is not a canonicalized slot specification.

    After error checking, this value is converted to a list of direct slot definition metaobjects before it is associated with the class metaobject. Conversion of each canonicalized slot specification to a direct slot definition metaobject is a two-step process. First, the generic function direct-slot-definition-class is called with the class metaobject and the canonicalized slot specification to determine the class of the new direct slot definition metaobject; this permits both the class metaobject and the canonicalized slot specification to control the resulting direct slot definition metaobject class. Second, make-instance is applied to the direct slot definition metaobject class and the canonicalized slot specification. This conversion could be implemented as shown in the following code:

    (defun convert-to-direct-slot-definition (class canonicalized-slot)
      (apply #'make-instance
             (apply #'direct-slot-definition-class
                    class canonicalized-slot)
             canonicalized-slot))

    If the class metaobject is being initialized, this argument defaults to the empty list.

    Once the direct slot definition metaobjects have been created, the specified reader and writer methods are created. The generic functions reader-method-class and writer-method-class are called to determine the classes of the method metaobjects created.

  • The :direct-superclasses argument is a list of class metaobjects. Classes which do not support multiple inheritance signal an error if the list contains more than one element.

    An error is signaled if this value is not a proper list or if validate-superclass applied to class and any element of this list returns false.

    When the class metaobject is being initialized, and this argument is either not supplied or is the empty list, this argument defaults as follows: if the class is an instance of standard-class or one of its subclasses the default value is a list of the class standard-object; if the class is an instance of funcallable-standard-class or one of its subclasses the default value is a list of the class funcallable-standard-object.

    After any defaulting of the value, the generic function add-direct-subclass is called once for each element of the list.

    When the class metaobject is being reinitialized and this argument is supplied, the generic function remove-direct-subclass is called once for each class metaobject in the previously stored value but not in the new value; the generic function add-direct-subclass is called once for each class metaobject in the new value but not in the previously stored value.

  • The :documentation argument is a string or nil.

    An error is signaled if this value is not a string or nil.

    If the class metaobject is being initialized, this argument defaults to nil.

  • The :name argument is an object.

    If the class is being initialized, this argument defaults to nil.

After the processing and defaulting of initialization arguments described above, the value of each initialization argument is associated with the class metaobject. These values can then be accessed by calling the corresponding generic function. The correspondences are as follows:

Table 6.1

Initialization arguments and accessors for class metaobjects.

Initialization Argument Generic Function
:direct-default-initargs class-direct-default-initargs
:direct-slots class-direct-slots
:direct-superclasses class-direct-superclasses
:documentation documentation
:name class-name

Instances of the class standard-class support multiple inheritance and reinitialization. Instances of the class funcallable-standard-class support multiple inheritance and reinitialization. For forward referenced classes, all of the initialization arguments default to nil.

Since built-in classes cannot be created or reinitialized by the user, an error is signaled if initialize-instance or reinitialize-instance are called to initialize or reinitialize a derived instance of the class built-in-class.

... » Initialization of Class Metaobjects » Methods

It is not specified which methods provide the initialization and reinitialization behavior described above. Instead, the information needed to allow portable programs to specialize this behavior is presented as a set of restrictions on the methods a portable program can define. The model is that portable initialization methods have access to the class generic-function method slot-definition metaobject when either all or none of the specified initialization has taken effect.

These restrictions govern the methods that a portable program can define on the generic functions initialize-instance, reinitialize-instance, and shared-initialize. These restrictions apply only to methods on these generic functions for which the first specializer is a subclass of the class class generic-function method slot-definition. Other portable methods on these generic functions are not affected by these restrictions.

  • Portable programs must not define methods on shared-initialize or reinitialize-instance.

  • For initialize-instance and reinitialize-instance:

    • Portable programs must not define primary methods.

    • Portable programs may define around-methods, but these must be extending, not overriding methods.

    • Portable before-methods must assume that when they are run, none of the initialization behavior described above has been completed.

    • Portable after-methods must assume that when they are run, all of the initialization behavior described above has been completed.

The results are undefined if any of these restrictions are violated.

Initialization » Initialization of Generic Function Metaobjects

... » Initialization of Generic Function Metaobjects » Introduction

A class generic function method slot definition metaobject can be created by calling make-instance. The initialization arguments establish the definition of the class generic function method slot definition. A class generic function method slot definition metaobject can be redefined by calling reinitialize-instance. Some classes of class generic function metaobject do not support redefinition; in these cases, cannot be redefined; calling reinitialize-instance signals an error.

Initialization of a class generic function method slot definition metaobject must be done by calling make-instance and allowing it to call initialize-instance. Reinitialization of a class generic function metaobject must be done by calling reinitialize-instance. Portable programs must not call initialize-instance directly to initialize a class generic function method slot definition metaobject. Portable programs must not call shared-initialize directly to initialize or reinitialize a class generic function method slot definition metaobject. Portable programs must not call change-class to change the class of any class generic function method slot definition metaobject or to turn a non-class non-generic-function non-method non-slot-definition object into a class generic function method slot definition metaobject.

Since metaobject classes may not be redefined, no behavior is specified for the result of calls to update-instance-for-redefined-class on class generic function method slot definition metaobjects. Since the class of a class generic function method slot definition metaobject cannot be changed, no behavior is specified for the result of calls to update-instance-for-different-class on class generic function method slot definition metaobjects.

During initialization or reinitialization, each initialization argument is checked for errors and then associated with the class generic function method slot definition metaobject. The value can then be accessed by calling the appropriate accessor as shown in Table 6.1 Table 6.2 Table 6.3 Table 6.4.

This section begins with a description of the error checking and processing of each initialization argument. This is followed by a table showing the generic functions that can be used to access the stored initialization arguments. Initialization behavior specific to the different specified class metaobject classes comes next. The section ends with a set of restrictions on portable methods affecting class generic function method metaobject initialization and reinitialization.

In these descriptions, the phrase this argument defaults to value means that when that initialization argument is not supplied, initialization or reinitialization is performed as if value had been supplied. For some initialization arguments this could be done by the use of default initialization arguments, but whether it is done this way is not specified. Implementations are free to define default initialization arguments for specified class generic function method slot definition metaobject classes. Portable programs are free to define default initialization arguments for portable subclasses of the class class generic-function method slot-definition.

Unless there is a specific note to the contrary, then during reinitialization, if an initialization argument is not supplied, the previously stored value is left unchanged.

... » Initialization of Generic Function Metaobjects » Initargs

  • The :argument-precedence-order argument is a list of symbols.

    An error is signaled if this argument appears but the :lambda-list argument does not appear. An error is signaled if this value is not a proper list or if this value is not a permutation of the symbols from the required arguments part of the :lambda-list initialization argument.

    When the generic function is being initialized or reinitialized, and this argument is not supplied, but the :lambda-list argument is supplied, this value defaults to the symbols from the required arguments part of the :lambda-list argument, in the order they appear in that argument. If neither argument is supplied, neither are initialized (see the description of :lambda-list).

  • The :declarations argument is a list of declarations.

    An error is signaled if this value is not a proper list or if each of its elements is not a legal declaration.

    When the generic function is being initialized, and this argument is not supplied, it defaults to the empty list.

  • The :documentation argument is a string or nil.

    An error is signaled if this value is not a string or nil.

    If the generic function is being initialized, this argument defaults to nil.

  • The :lambda-list argument is a lambda list.

    An error is signaled if this value is not a proper generic function lambda list.

    When the generic function is being initialized, and this argument is not supplied, the generic function's lambda list is not initialized. The lambda list will be initialized later, either when the first method is added to the generic function, or a later reinitialization of the generic function.

  • The :method-combination argument is a method combination metaobject.

  • The :method-class argument is a class metaobject.

    An error is signaled if this value is not a subclass of the class method.

    When the generic function is being initialized, and this argument is not supplied, it defaults to the class standard-method.

  • The :name argument is an object.

    If the generic function is being initialized, this argument defaults to nil.

After the processing and defaulting of initialization arguments described above, the value of each initialization argument is associated with the generic function metaobject. These values can then be accessed by calling the corresponding generic function. The correspondences are as follows:

Table 6.2

Initialization arguments and accessors for generic function metaobjects.

Initialization Argument Generic Function
:argument-precedence-order generic-function-argument-precedence-order
:declarations generic-function-declarations
:documentation documentation
:lambda-list generic-function-lambda-list
:method-combination generic-function-method-combination
:method-class generic-function-method-class
:name generic-function-name

... » Initialization of Generic Function Metaobjects » Methods

It is not specified which methods provide the initialization and reinitialization behavior described above. Instead, the information needed to allow portable programs to specialize this behavior is presented as a set of restrictions on the methods a portable program can define. The model is that portable initialization methods have access to the class generic-function method slot-definition metaobject when either all or none of the specified initialization has taken effect.

These restrictions govern the methods that a portable program can define on the generic functions initialize-instance, reinitialize-instance, and shared-initialize. These restrictions apply only to methods on these generic functions for which the first specializer is a subclass of the class class generic-function method slot-definition. Other portable methods on these generic functions are not affected by these restrictions.

  • Portable programs must not define methods on shared-initialize or reinitialize-instance.

  • For initialize-instance and reinitialize-instance:

    • Portable programs must not define primary methods.

    • Portable programs may define around-methods, but these must be extending, not overriding methods.

    • Portable before-methods must assume that when they are run, none of the initialization behavior described above has been completed.

    • Portable after-methods must assume that when they are run, all of the initialization behavior described above has been completed.

The results are undefined if any of these restrictions are violated.

Initialization » Initialization of Method Metaobjects

... » Initialization of Method Metaobjects » Introduction

A class generic function method slot definition metaobject can be created by calling make-instance. The initialization arguments establish the definition of the class generic function method slot definition. A class generic function method slot definition metaobject can be redefined by calling reinitialize-instance. Some classes of class generic function metaobject do not support redefinition; in these cases, cannot be redefined; calling reinitialize-instance signals an error.

Initialization of a class generic function method slot definition metaobject must be done by calling make-instance and allowing it to call initialize-instance. Reinitialization of a class generic function metaobject must be done by calling reinitialize-instance. Portable programs must not call initialize-instance directly to initialize a class generic function method slot definition metaobject. Portable programs must not call shared-initialize directly to initialize or reinitialize a class generic function method slot definition metaobject. Portable programs must not call change-class to change the class of any class generic function method slot definition metaobject or to turn a non-class non-generic-function non-method non-slot-definition object into a class generic function method slot definition metaobject.

Since metaobject classes may not be redefined, no behavior is specified for the result of calls to update-instance-for-redefined-class on class generic function method slot definition metaobjects. Since the class of a class generic function method slot definition metaobject cannot be changed, no behavior is specified for the result of calls to update-instance-for-different-class on class generic function method slot definition metaobjects.

During initialization or reinitialization, each initialization argument is checked for errors and then associated with the class generic function method slot definition metaobject. The value can then be accessed by calling the appropriate accessor as shown in Table 6.1 Table 6.2 Table 6.3 Table 6.4.

This section begins with a description of the error checking and processing of each initialization argument. This is followed by a table showing the generic functions that can be used to access the stored initialization arguments. Initialization behavior specific to the different specified class metaobject classes comes next. The section ends with a set of restrictions on portable methods affecting class generic function method metaobject initialization and reinitialization.

In these descriptions, the phrase this argument defaults to value means that when that initialization argument is not supplied, initialization or reinitialization is performed as if value had been supplied. For some initialization arguments this could be done by the use of default initialization arguments, but whether it is done this way is not specified. Implementations are free to define default initialization arguments for specified class generic function method slot definition metaobject classes. Portable programs are free to define default initialization arguments for portable subclasses of the class class generic-function method slot-definition.

Unless there is a specific note to the contrary, then during reinitialization, if an initialization argument is not supplied, the previously stored value is left unchanged.

... » Initialization of Method Metaobjects » Initargs

  • The :qualifiers argument is a list of method qualifiers. An error is signaled if this value is not a proper list, or if any element of the list is not a non-null atom. This argument defaults to the empty list.

  • The :lambda-list argument is the unspecialized lambda list of the method. An error is signaled if this value is not a proper lambda list. If this value is not supplied, an error is signaled.

  • The :specializers argument is a list of the specializer metaobjects for the method. An error is signaled if this value is not a proper list, or if the length of the list differs from the number of required arguments in the :lambda-list argument, or if any element of the list is not a specializer metaobject. If this value is not supplied, an error is signaled.

  • The :function argument is a method function. It must be compatible with the methods on compute-effective-method defined for this class of method and generic function with which it will be used. That is, it must accept the same number of arguments as all uses of call-method that will call it supply. (See compute-effective-method for more information.) An error is signaled if this argument is not supplied.

  • When the method being initialized is an instance of a subclass of standard-accessor-method, the :slot-definition initialization argument must be provided. Its value is the direct slot definition metaobject which defines this accessor method. An error is signaled if the value is not an instance of a subclass of direct-slot-definition.

  • The :documentation argument is a string or nil. An error is signaled if this value is not a string or nil. This argument defaults to nil.

After the processing and defaulting of initialization arguments described above, the value of each initialization argument is associated with the method metaobject. These values can then be accessed by calling the corresponding generic function. The correspondences are as follows:

Table 6.3

Initialization arguments and accessors for method metaobjects.

Initialization Argument Generic Function
:qualifiers method-qualifiers
:lambda-list method-lambda-list
:specializers method-specializers
:function method-function
:slot-definition accessor-method-slot-definition
:documentation documentation

... » Initialization of Method Metaobjects » Methods

It is not specified which methods provide the initialization and reinitialization behavior described above. Instead, the information needed to allow portable programs to specialize this behavior is presented as a set of restrictions on the methods a portable program can define. The model is that portable initialization methods have access to the class generic-function method slot-definition metaobject when either all or none of the specified initialization has taken effect.

These restrictions govern the methods that a portable program can define on the generic functions initialize-instance, reinitialize-instance, and shared-initialize. These restrictions apply only to methods on these generic functions for which the first specializer is a subclass of the class class generic-function method slot-definition. Other portable methods on these generic functions are not affected by these restrictions.

  • Portable programs must not define methods on shared-initialize or reinitialize-instance.

  • For initialize-instance and reinitialize-instance:

    • Portable programs must not define primary methods.

    • Portable programs may define around-methods, but these must be extending, not overriding methods.

    • Portable before-methods must assume that when they are run, none of the initialization behavior described above has been completed.

    • Portable after-methods must assume that when they are run, all of the initialization behavior described above has been completed.

The results are undefined if any of these restrictions are violated.

Initialization » Initialization of Slot Definition Metaobjects

... » Initialization of Slot Definition Metaobjects » Introduction

A class generic function method slot definition metaobject can be created by calling make-instance. The initialization arguments establish the definition of the class generic function method slot definition. A class generic function method slot definition metaobject can be redefined by calling reinitialize-instance. Some classes of class generic function metaobject do not support redefinition; in these cases, cannot be redefined; calling reinitialize-instance signals an error.

Initialization of a class generic function method slot definition metaobject must be done by calling make-instance and allowing it to call initialize-instance. Reinitialization of a class generic function metaobject must be done by calling reinitialize-instance. Portable programs must not call initialize-instance directly to initialize a class generic function method slot definition metaobject. Portable programs must not call shared-initialize directly to initialize or reinitialize a class generic function method slot definition metaobject. Portable programs must not call change-class to change the class of any class generic function method slot definition metaobject or to turn a non-class non-generic-function non-method non-slot-definition object into a class generic function method slot definition metaobject.

Since metaobject classes may not be redefined, no behavior is specified for the result of calls to update-instance-for-redefined-class on class generic function method slot definition metaobjects. Since the class of a class generic function method slot definition metaobject cannot be changed, no behavior is specified for the result of calls to update-instance-for-different-class on class generic function method slot definition metaobjects.

During initialization or reinitialization, each initialization argument is checked for errors and then associated with the class generic function method slot definition metaobject. The value can then be accessed by calling the appropriate accessor as shown in Table 6.1 Table 6.2 Table 6.3 Table 6.4.

This section begins with a description of the error checking and processing of each initialization argument. This is followed by a table showing the generic functions that can be used to access the stored initialization arguments. Initialization behavior specific to the different specified class metaobject classes comes next. The section ends with a set of restrictions on portable methods affecting class generic function method metaobject initialization and reinitialization.

In these descriptions, the phrase this argument defaults to value means that when that initialization argument is not supplied, initialization or reinitialization is performed as if value had been supplied. For some initialization arguments this could be done by the use of default initialization arguments, but whether it is done this way is not specified. Implementations are free to define default initialization arguments for specified class generic function method slot definition metaobject classes. Portable programs are free to define default initialization arguments for portable subclasses of the class class generic-function method slot-definition.

Unless there is a specific note to the contrary, then during reinitialization, if an initialization argument is not supplied, the previously stored value is left unchanged.

... » Initialization of Slot Definition Metaobjects » Initargs

  • The :name argument is a slot name. An error is signaled if this argument is not a symbol which can be used as a variable name. An error is signaled if this argument is not supplied.

  • The :initform argument is a form. The :initform argument defaults to nil. An error is signaled if the :initform argument is supplied, but the :initfunction argument is not supplied.

  • The :initfunction argument is a function of zero arguments which, when called, evaluates the :initform in the appropriate lexical environment. The :initfunction argument defaults to false. An error is signaled if the :initfunction argument is supplied, but the :initform argument is not supplied.

  • The :type argument is a type specifier name. An error is signaled otherwise. The :type argument defaults to the symbol T.

  • The :allocation argument is a symbol. An error is signaled otherwise. The :allocation argument defaults to the symbol :instance.

  • The :initargs argument is a list of symbols. An error is signaled if this argument is not a proper list, or if any element of this list is not a symbol. The :initargs argument defaults to the empty list.

  • The :readers argument is a list of function names. An error is signaled if it is not a proper list, or if any element is not a valid function name. It defaults to the empty list. An error is signaled if this argument is supplied and the metaobject is not a direct slot definition.

  • The :writers argument is a list of function names. An error is signaled if it is not a proper list, or if any element is not a valid function name. It defaults to the empty list. An error is signaled if this argument is supplied and the metaobject is not a direct slot definition.

  • The :documentation argument is a string or nil. An error is signaled otherwise. The :documentation argument defaults to nil.

After the processing and defaulting of initialization arguments described above, the value of each initialization argument is associated with the slot definition metaobject. These values can then be accessed by calling the corresponding generic function. The correspondences are as follows:

Table 6.4

Initialization arguments and accessors
for slot definition metaobjects.

Initialization Argument Generic Function
:name slot-definition-name
:initform slot-definition-initform
:initfunction slot-definition-initfunction
:type slot-definition-type
:allocation slot-definition-allocation
:initargs slot-definition-initargs
:readers slot-definition-readers
:writers slot-definition-writers
:documentation documentation

... » Initialization of Slot Definition Metaobjects » Methods

It is not specified which methods provide the initialization and reinitialization behavior described above. Instead, the information needed to allow portable programs to specialize this behavior is presented as a set of restrictions on the methods a portable program can define. The model is that portable initialization methods have access to the class generic-function method slot-definition metaobject when either all or none of the specified initialization has taken effect.

These restrictions govern the methods that a portable program can define on the generic functions initialize-instance, reinitialize-instance, and shared-initialize. These restrictions apply only to methods on these generic functions for which the first specializer is a subclass of the class class generic-function method slot-definition. Other portable methods on these generic functions are not affected by these restrictions.

  • Portable programs must not define methods on shared-initialize or reinitialize-instance.

  • For initialize-instance and reinitialize-instance:

    • Portable programs must not define primary methods.

    • Portable programs may define around-methods, but these must be extending, not overriding methods.

    • Portable before-methods must assume that when they are run, none of the initialization behavior described above has been completed.

    • Portable after-methods must assume that when they are run, all of the initialization behavior described above has been completed.

The results are undefined if any of these restrictions are violated.

intern-eql-specializer

Function intern-eql-specializer

object => eql-specializer

Arguments and Values

  • object -- Any Lisp object.
  • eql-specializer -- The eql specializer metaobject for object.

Arguments

The object argument is any Lisp object.

Values

The result is the eql specializer metaobject for object.

Description

This function returns the unique eql specializer metaobject for object, creating one if necessary. Two calls to intern-eql-specializer with eql arguments will return the same (i.e., eq) value.

Remarks

The result of calling eql-specializer-object on the result of a call to intern-eql-specializer is only guaranteed to be eql to the original object argument, not necessarily eq.

make-instance

Generic Function make-instance

class &rest initargs => instance

Arguments and Values

  • class -- A class metaobject or a class name.
  • initargs -- A list of alternating initialization argument names and values.
  • instance -- A newly allocated and initialized instance of class.

Arguments

The class argument is a class metaobject or a class name.

The initargs argument is a list of alternating initialization argument names and values.

Values

The result is a newly allocated and initialized instance of class.

Description

The generic function make-instance creates and returns a new instance of the given class. Its behavior and use is described in the CLOS specification.

Methods

Method make-instance

(class symbol) &rest initargs => instance

Description

This method simply invokes make-instance recursively on the arguments (find-class class) and initargs.

make-method-lambda

Generic Function make-method-lambda

generic-function method lambda-expression environment => resulting-lambda-expression initargs

Arguments and Values

  • generic-function -- A generic function metaobject.
  • method -- A (possibly uninitialized) method metaobject.
  • lambda-expression -- A lambda expression.
  • environment -- An environment object.
  • resulting-lambda-expression -- A lambda expression.
  • initargs -- A list of initialization arguments and values.

Arguments

The generic-function argument is a generic function metaobject.

The method argument is a (possibly uninitialized) method metaobject.

The lambda-expression argument is a lambda expression.

The environment argument is the same as the &environment argument to macro expansion functions.

Values

This generic function returns two values. The first is a lambda expression, the second is a list of initialization arguments and values.

Description

This generic function is called to produce a lambda expression which can itself be used to produce a method function for a method and generic function with the specified classes. The generic function and method the method function will be used with are not required to be the given ones. Moreover, the method metaobject may be uninitialized.

Either the function compile, the special form function or the function coerce must be used to convert the lambda expression to a method function. The method function itself can be applied to arguments with apply or funcall.

When a method is actually called by an effective method, its first argument will be a list of the arguments to the generic function. Its remaining arguments will be all but the first argument passed to call-method. By default, all method functions must accept two arguments: the list of arguments to the generic function and the list of next methods.

For a given generic function and method class, the applicable methods on make-method-lambda and compute-effective-method must be consistent in the following way: each use of call-method returned by the method on compute-effective-method must have the same number of arguments, and the method lambda returned by the method on make-method-lambda must accept a corresponding number of arguments.

Note that the system-supplied implementation of call-next-method is not required to handle extra arguments to the method function. Users who define additional arguments to the method function must either redefine or forego call-next-method. (See the example below.)

When the method metaobject is created with make-instance, the method function must be the value of the :function initialization argument. The additional initialization arguments, returned as the second value of this generic function, must also be passed in this call to make-instance.

Methods

Method make-method-lambda

(generic-function standard-generic-function) (method standard-method) lambda-expression environment => resulting-lambda-expression initargs

Description

This method returns a method lambda which accepts two arguments, the list of arguments to the generic function, and the list of next methods. What initialization arguments may be returned in the second value are unspecified.

This method can be overridden.

Example

This example shows how to define a kind of method which, from within the body of the method, has access to the actual method metaobject for the method. This simplified code overrides whatever method combination is specified for the generic function, implementing a simple method combination supporting only primary methods, call-next-method and next-method-p. (In addition, it's a simplified version of call-next-method which does no error checking.)

Notice that the extra lexical function bindings get wrapped around the body before call-next-method is called. In this way, the user's definition of call-next-method and next-method-p are sure to override the system's definitions.

(defclass my-generic-function (standard-generic-function)
     ()
  (:default-initargs :method-class (find-class 'my-method)))

(defclass my-method (standard-method) ())

(defmethod make-method-lambda ((gf my-generic-function)
                               (method my-method)
                               lambda-expression
                               environment)
  (declare (ignore environment))
  `(lambda (args next-methods this-method)
     (,(call-next-method gf method
         `(lambda ,(cadr lambda-expression)
            (flet ((this-method () this-method)
                   (call-next-method (&rest cnm-args)
                     (funcall (method-function (car next-methods))
                              (or cnm-args args)
                              (cdr next-methods)
                              (car next-methods)))
                   (next-method-p ()
                     (not (null next-methods))))
              ,@(cddr lambda-expression)))
          environment)
       args next-methods)))

(defmethod compute-effective-method ((gf my-generic-function)
                                     method-combination
                                     methods)
  `(call-method ,(car methods) ,(cdr methods) ,(car methods)))

map-dependents

Generic Function map-dependents

metaobject function => unspecified

Arguments and Values

  • metaobject -- A class or generic function metaobject.
  • function -- A function which accepts one argument.

Arguments

The metaobject argument is a class or generic function metaobject.

The function argument is a function which accepts one argument.

Values

The value returned is unspecified.

Description

This generic function applies function to each of the dependents of metaobject. The order in which the dependents are processed is not specified, but function is applied to each dependent once and only once. If, during the mapping, add-dependent or remove-dependent is called to alter the dependents of metaobject, it is not specified whether the newly added or removed dependent will have function applied to it.

Methods

Remarks

See the Dependent Maintenance Protocol section for remarks about the use of this facility.

Readers for Method Metaobjects

Readers for Method Metaobjects » Introduction

In this and the immediately following sections, the "reader" generic functions which simply return information associated with a particular kind of metaobject are presented together. General information is presented first, followed by a description of the purpose of each, and ending with the specified methods for these generic functions.

The reader generic functions which simply return information associated with class generic function method slot definition metaobjects are presented together in this section here in the format described under Readers for Class Metaobjects.

Each of the reader generic functions for class generic function method slot definition metaobjects has the same syntax, accepting one required argument called class generic-function method slot, which must be a class generic function method slot definition metaobject; otherwise, an error is signaled. An error is also signaled if the class generic function method slot definition metaobject has not been initialized.

These generic functions can be called by the user or the implementation.

For any of these generic functions which returns a list, such lists will not be mutated by the implementation. The results are undefined if a portable program allows such a list to be mutated.

Readers for Method Metaobjects » Readers

Readers for Method Metaobjects » ... » method-function

Generic Function method-function

method => function

Description

Returns the method function of method. This is the defaulted value of the :function initialization argument that was associated with the method during initialization.

Generated

Method method-function

(method standard-method) => function

Description

No behavior is specified for this method beyond that which is specified for the corresponding generic function.

Readers for Method Metaobjects » ... » method-generic-function

Generic Function method-generic-function

method => generic-function

Description

Returns the generic function that method is currently connected to, or nil if it is not currently connected to any generic function. This value is either a generic function metaobject or nil. When a method is first created it is not connected to any generic function. This connection is maintained by the generic functions add-method and remove-method.

Generated

Readers for Method Metaobjects » ... » method-lambda-list

Generic Function method-lambda-list

method => lambda-list

Description

Returns the (unspecialized) lambda list of method. This value is a Common Lisp lambda list. This is the defaulted value of the :lambda-list initialization argument that was associated with the method during initialization.

Generated

Method method-lambda-list

(method standard-method) => lambda-list

Description

No behavior is specified for this method beyond that which is specified for the corresponding generic function.

Readers for Method Metaobjects » ... » method-specializers

Generic Function method-specializers

method => specializers

Description

Returns a list of the specializers of method. This value is a list of specializer metaobjects. This is the defaulted value of the :specializers initialization argument that was associated with the method during initialization.

Generated

Method method-specializers

(method standard-method) => specializers

Description

No behavior is specified for this method beyond that which is specified for the corresponding generic function.

Readers for Method Metaobjects » ... » method-qualifiers

Generic Function method-qualifiers

method => list

Description

Returns a (possibly empty) list of the qualifiers of method. This value is a list of non-nil atoms. This is the defaulted value of the :qualifiers initialization argument that was associated with the method during initialization.

Generated

Method method-qualifiers

(method standard-method) => list

Description

No behavior is specified for this method beyond that which is specified for the corresponding generic function.

Readers for Method Metaobjects » ... » accessor-method-slot-definition

Generic Function accessor-method-slot-definition

method => direct-slot-definition

Description

This accessor can only be called on accessor methods. It returns the direct slot definition metaobject that defined this method. This is the value of the :slot-definition initialization argument associated with the method during initialization.

Generated

Method accessor-method-slot-definition

(method standard-accessor-method) => direct-slot-definition

Description

No behavior is specified for this method beyond that which is specified for the corresponding generic function.

Readers for Method Metaobjects » Methods

The specified methods for the method metaobject readers are presented below.

(method standard-method) => result

No behavior is specified for these methods beyond that which is specified for their respective generic functions.

reader-method-class

Generic Function reader-method-class

class direct-slot &rest initargs => reader-method-class

Arguments and Values

  • class -- A class metaobject.
  • direct-slot -- A direct slot definition metaobject.
  • initargs -- Alternating initialization argument names and values.
  • reader-method-class -- A class metaobject.

Arguments

The class argument is a class metaobject.

The direct-slot argument is a direct slot definition metaobject.

The initargs argument consists of alternating initialization argument names and values.

Values

The value returned is a class metaobject.

Description

This generic function is called to determine the class of reader methods created during class initialization and reinitialization. The result must be a subclass of standard-reader-method.

The initargs argument must be the same as will be passed to make-instance to create the reader method. The initargs must include :slot-definition with slot-definition as its value.

Methods

remove-dependent

Generic Function remove-dependent

metaobject dependent => unspecified

Arguments and Values

  • metaobject -- A class or generic function metaobject.
  • dependent -- An object.

Arguments

The metaobject argument is a class or generic function metaobject.

The dependent argument is an object.

Values

The value returned by this generic function is unspecified.

Description

This generic function removes dependent from the dependents of metaobject. If dependent is not one of the dependents of metaobject, no error is signaled.

The generic function map-dependents can be called to access the set of dependents of a class or generic function. The generic function add-dependent can be called to add an object to the set of dependents of a class or generic function. The effect of calling add-dependent or remove-dependent while a call to map-dependents on the same class or generic function is in progress is unspecified.

The situations in which remove-dependent is called are not specified.

Methods

Remarks

See the Dependent Maintenance Protocol section for remarks about the use of this facility.

remove-direct-method

Generic Function remove-direct-method

specializer method => unspecified

Arguments and Values

  • specializer -- A specializer metaobject.
  • method -- A method metaobject.

Arguments

The specializer argument is a specializer metaobject.

The method argument is a method metaobject.

Values

The value returned by remove-direct-method is unspecified.

Description

This generic function is called to maintain a set of backpointers from a specializer to the set of methods specialized to it. If method is in the set it is removed. If it is not, no error is signaled.

This set can be accessed as a list by calling the generic function specializer-direct-methods. Methods are added to the set by add-direct-method.

The generic function remove-direct-method is called by remove-method whenever a method is removed from a generic function. It is called once for each of the specializers of the method. Note that in cases where a specializer appears more than once in the specializers of a method, this generic function will be called more than once with the same specializer as argument.

The results are undefined if the specializer argument is not one of the specializers of the method argument.

Methods

Method remove-direct-method

(specializer class) (method method) => unspecified

Description

This method implements the behavior of the generic function for class specializers. No behavior is specified for this method beyond that which is specified for the generic function.

This method cannot be overridden unless the following methods are overridden as well:

Method remove-direct-method

(specializer eql-specializer) (method method) => unspecified

Description

This method implements the behavior of the generic function for eql specializers. No behavior is specified for this method beyond that which is specified for the generic function.

remove-direct-subclass

Generic Function remove-direct-subclass

superclass subclass => unspecified

Arguments and Values

  • superclass -- A class metaobject.
  • subclass -- A class metaobject.

Arguments

The superclass argument is a class metaobject.

The subclass argument is a class metaobject.

Values

The value returned by this generic function is unspecified.

Description

This generic function is called to maintain a set of backpointers from a class to its direct subclasses. It removes subclass from the set of direct subclasses of superclass. No error is signaled if subclass is not in this set.

Whenever a class is reinitialized, this generic function is called once with each deleted direct superclass of the class.

Methods

remove-method

Generic Function remove-method

generic-function method => generic-function

Arguments and Values

  • generic-function -- A generic function metaobject.
  • method -- A method metaobject.

Arguments

The generic-function argument is a generic function metaobject.

The method argument is a method metaobject.

Values

The generic-function argument is returned.

Description

This generic function breaks the association between a generic function and one of its methods.

No error is signaled if the method is not among the methods of the generic function.

Breaking the association between the method and the generic function proceeds in four steps:

  1. remove method from the set returned by generic-function-methods and arrange for method-generic-function to return nil;

  2. call remove-direct-method for each of the method's specializers;

  3. call compute-discriminating-function and install its result with set-funcallable-instance-function; and

  4. update the dependents of the generic function.

The generic function remove-method can be called by the user or the implementation.

Methods

Method remove-method

(generic-function standard-generic-function) (method standard-method) => generic-function

Description

No behavior is specified for this method beyond that which is specified for the generic function.

set-funcallable-instance-function

Function set-funcallable-instance-function

funcallable-instance function => unspecified

Arguments and Values

Arguments

The funcallable-instance argument is a funcallable instance (it must have been returned by allocate-instance (funcallable-standard-class)).

The function argument is a function.

Values

The value returned by this function is unspecified.

Description

This function is called to set or to change the function of a funcallable instance. After set-funcallable-instance-function is called, any subsequent calls to funcallable-instance will run the new function.

(setf class-name)

Generic Function (setf class-name)

new-name class => new-name

Arguments and Values

  • class -- A class metaobject.
  • new-name -- Any Lisp object.

Arguments

The class argument is a class metaobject.

The new-name argument is any Lisp object.

Values

This function returns its new-name argument.

Description

This function changes the name of class to new-name. This value is usually a symbol, or nil if the class has no name.

This function works by calling reinitialize-instance with class as its first argument, the symbol :name as its second argument and new-name as its third argument.

(setf generic-function-name)

Generic Function (setf generic-function-name)

new-name generic-function => new-name

Arguments and Values

  • generic-function -- A generic function metaobject.
  • new-name -- A function name or nil.

Arguments

The generic-function argument is a generic function metaobject.

The new-name argument is a function name or nil.

Values

The function returns its new-name argument.

Description

This function changes the name of generic-function to new-name. This value is usually a function name (i.e., a symbol or a list of the form (setf symbol)) or nil, if the generic function is to have no name.

This function works by calling reinitialize-instance with generic-function as its first argument, the symbol :name as its second argument and new-name as its third argument.

(setf slot-value-using-class)

Generic Function (setf slot-value-using-class)

new-value class object slot => new-value

Arguments and Values

  • new-value -- An object.
  • class -- A class metaobject. It is the class of the object argument.
  • object -- An object.
  • slot -- An effective slot definition metaobject.

Arguments

The new-value argument is an object.

The class argument is a class metaobject. It is the class of the object argument.

The object argument is an object.

The slot argument is an effective slot definition metaobject.

Values

This generic function returns the new-value argument.

Description

The generic function (setf slot-value-using-class) implements the behavior of the (setf slot-value) function. It is called by (setf slot-value) with the class of object as its second argument and the pertinent effective slot definition metaobject as its fourth argument.

The generic function (setf slot-value-using-class) sets the value contained in the given slot of the given object to the given new value; any previous value is lost.

The results are undefined if the class argument is not the class of the object argument, or if the slot argument does not appear among the set of effective slots associated with the class argument.

Methods

Method (setf slot-value-using-class)

new-value (class standard-class) object (slot standard-effective-slot-definition) => new-value

or

new-value (class funcallable-standard-class) object (slot standard-effective-slot-definition) => new-value

Description

These methods implement the full behavior of this generic function for slots with allocation :instance and :class. If the supplied slot has an allocation other than :instance or :class an error is signaled.

Overriding these methods is permitted, but may require overriding other methods in the standard implementation of the slot access protocol.

Method (setf slot-value-using-class)

new-value (class built-in-class) object slot => |

Description

This method signals an error.

slot-boundp-using-class

Generic Function slot-boundp-using-class

class object slot => generalized-boolean

Arguments and Values

  • class -- A class metaobject. It is the class of the object argument.
  • object -- An object.
  • slot -- An effective slot definition metaobject.
  • generalized-boolean -- A generalized boolean.

Arguments

The class argument is a class metaobject. It is the class of the object argument.

The object argument is an object.

The slot argument is an effective slot definition metaobject.

Values

This generic function returns true or false.

Description

This generic function implements the behavior of the slot-boundp function. It is called by slot-boundp with the class of object as its first argument and the pertinent effective slot definition metaobject as its third argument.

The generic function slot-boundp-using-class tests whether a specific slot in an instance is bound.

The results are undefined if the class argument is not the class of the object argument, or if the slot argument does not appear among the set of effective slots associated with the class argument.

Methods

Method slot-boundp-using-class

(class standard-class) object (slot standard-effective-slot-definition) => generalized-boolean

or

(class funcallable-standard-class) object (slot standard-effective-slot-definition) => generalized-boolean

Description

These methods implement the full behavior of this generic function for slots with allocation :instance and :class. If the supplied slot has an allocation other than :instance or :class an error is signaled.

Overriding these methods is permitted, but may require overriding other methods in the standard implementation of the slot access protocol.

Method slot-boundp-using-class

(class built-in-class) object slot => |

Description

This method signals an error.

Remarks

In cases where the class metaobject class does not distinguish unbound slots, true should be returned.

Readers for Slot Definition Metaobjects

Readers for Slot Definition Metaobjects » Introduction

In this and the immediately following sections, the "reader" generic functions which simply return information associated with a particular kind of metaobject are presented together. General information is presented first, followed by a description of the purpose of each, and ending with the specified methods for these generic functions.

The reader generic functions which simply return information associated with class generic function method slot definition metaobjects are presented together in this section here in the format described under Readers for Class Metaobjects.

Each of the reader generic functions for class generic function method slot definition metaobjects has the same syntax, accepting one required argument called class generic-function method slot, which must be a class generic function method slot definition metaobject; otherwise, an error is signaled. An error is also signaled if the class generic function method slot definition metaobject has not been initialized.

These generic functions can be called by the user or the implementation.

For any of these generic functions which returns a list, such lists will not be mutated by the implementation. The results are undefined if a portable program allows such a list to be mutated.

Readers for Slot Definition Metaobjects » Readers

Readers for Slot Definition Metaobjects » ... » slot-definition-allocation

Generic Function slot-definition-allocation

slot => symbol

Description

Returns the allocation of slot. This is a symbol. This is the defaulted value of the :allocation initialization argument that was associated with the slot definition metaobject during initialization.

Generated

Method slot-definition-allocation

(slot-definition standard-slot-definition) => symbol

Description

No behavior is specified for this method beyond that which is specified for the corresponding generic function.

Readers for Slot Definition Metaobjects » ... » slot-definition-initargs

Generic Function slot-definition-initargs

slot => initargs

Description

Returns the set of initialization argument keywords for slot. This is the defaulted value of the :initargs initialization argument that was associated with the slot definition metaobject during initialization.

Generated

Method slot-definition-initargs

(slot-definition standard-slot-definition) => initargs

Description

No behavior is specified for this method beyond that which is specified for the corresponding generic function.

Readers for Slot Definition Metaobjects » ... » slot-definition-initform

Generic Function slot-definition-initform

slot => initform

Description

Returns the initialization form of slot. This can be any form. This is the defaulted value of the :initform initialization argument that was associated with the slot definition metaobject during initialization. When slot has no initialization form, the value returned is unspecified (however, slot-definition-initfunction is guaranteed to return nil).

Generated

Method slot-definition-initform

(slot-definition standard-slot-definition) => initform

Description

No behavior is specified for this method beyond that which is specified for the corresponding generic function.

Readers for Slot Definition Metaobjects » ... » slot-definition-initfunction

Generic Function slot-definition-initfunction

slot => initfunction

Description

Returns the initialization function of slot. This value is either a function of no arguments, or nil, indicating that the slot has no initialization function. This is the defaulted value of the :initfunction initialization argument that was associated with the slot definition metaobject during initialization.

Generated

Method slot-definition-initfunction

(slot-definition standard-slot-definition) => initfunction

Description

No behavior is specified for this method beyond that which is specified for the corresponding generic function.

Readers for Slot Definition Metaobjects » ... » slot-definition-name

Generic Function slot-definition-name

slot => symbol

Description

Returns the name of slot. This value is a symbol that can be used as a variable name. This is the value of the :name initialization argument that was associated with the slot definition metaobject during initialization.

Generated

Method slot-definition-name

(slot-definition standard-slot-definition) => symbol

Description

No behavior is specified for this method beyond that which is specified for the corresponding generic function.

Readers for Slot Definition Metaobjects » ... » slot-definition-type

Generic Function slot-definition-type

slot => type

Description

Returns the type of slot. This is a type specifier name. This is the defaulted value of the :type initialization argument that was associated with the slot definition metaobject during initialization.

Generated

Method slot-definition-type

(slot-definition standard-slot-definition) => type

Description

No behavior is specified for this method beyond that which is specified for the corresponding generic function.

Readers for Slot Definition Metaobjects » Methods

The specified methods for the slot definition metaobject readers are presented below.

(slot-definition standard-slot-definition) => result

No behavior is specified for these methods beyond that which is specified for their respective generic functions.

Readers for Slot Definition Metaobjects » Direct Slot Definition Metaobjects

The following additional reader generic functions are defined for direct slot definition metaobjects.

Generic Function slot-definition-readers

direct-slot => readers

Description

Returns a (possibly empty) set of readers of the direct-slot. This value is a list of function names. This is the defaulted value of the :readers initialization argument that was associated with the direct slot definition metaobject during initialization.

Generic Function slot-definition-writers

direct-slot => writers

Description

Returns a (possibly empty) set of writers of the direct-slot. This value is a list of function names. This is the defaulted value of the :writers initialization argument that was associated with the direct slot definition metaobject during initialization.

Method slot-definition-readers

Method slot-definition-writers

(direct-slot-definition standard-direct-slot-definition) => result

No behavior is specified for these methods beyond what is specified for their generic functions.

Readers for Slot Definition Metaobjects » Effective Slot Definition Metaobjects

Generic Function slot-definition-location

effective-slot-definition => location

Description

Returns the location of effective-slot-definition. The meaning and interpretation of this value is described in the section called Instance Structure Protocol.

slot-makunbound-using-class

Generic Function slot-makunbound-using-class

class object slot => object

Arguments and Values

  • class -- A class metaobject. It is the class of the object argument.
  • object -- An object.
  • slot -- An effective slot definition metaobject.

Arguments

The class argument is a class metaobject. It is the class of the object argument.

The object argument is an object.

The slot argument is an effective slot definition metaobject.

Values

This generic function returns its object argument.

Description

This generic function implements the behavior of the slot-makunbound function. It is called by slot-makunbound with the class of object as its first argument and the pertinent effective slot definition metaobject as its third argument.

The generic function slot-makunbound-using-class restores a slot in an object to its unbound state. The interpretation of restoring a slot to its unbound state depends on the class metaobject class.

The results are undefined if the class argument is not the class of the object argument, or if the slot argument does not appear among the set of effective slots associated with the class argument.

Methods

Method slot-makunbound-using-class

(class standard-class) object (slot standard-effective-slot-definition) => object

or

(class funcallable-standard-class) object (slot standard-effective-slot-definition) => object

Description

These methods implement the full behavior of this generic function for slots with allocation :instance and :class. If the supplied slot has an allocation other than :instance or :class an error is signaled.

Overriding these methods is permitted, but may require overriding other methods in the standard implementation of the slot access protocol.

Method slot-makunbound-using-class

(class built-in-class) object slot => |

Description

This method signals an error.

slot-value-using-class

Generic Function slot-value-using-class

class object slot => value

Arguments and Values

  • class -- A class metaobject. It is the class of the object argument.
  • object -- An object.
  • slot -- An effective slot definition metaobject.
  • value -- An object.

Arguments

The class argument is a class metaobject. It is the class of the object argument.

The object argument is an object.

The slot argument is an effective slot definition metaobject.

Values

The value returned by this generic function is an object.

Description

This generic function implements the behavior of the slot-value function. It is called by slot-value with the class of object as its first argument and the pertinent effective slot definition metaobject as its third argument.

The generic function slot-value-using-class returns the value contained in the given slot of the given object. If the slot is unbound slot-unbound is called.

The results are undefined if the class argument is not the class of the object argument, or if the slot argument does not appear among the set of effective slots associated with the class argument.

Methods

Method slot-value-using-class

Description

These methods implement the full behavior of this generic function for slots with allocation :instance and :class. If the supplied slot has an allocation other than :instance or :class an error is signaled.

Overriding these methods is permitted, but may require overriding other methods in the standard implementation of the slot access protocol.

Method slot-value-using-class

(class built-in-class) object slot => |

Description

This method signals an error.

specializer-direct-generic-functions

Generic Function specializer-direct-generic-functions

specializer => generic-functions

Arguments and Values

  • specializer -- A specializer metaobject.
  • generic-functions -- A possibly empty list of generic function metaobjects.

Arguments

The specializer argument is a specializer metaobject.

Values

The result of this generic function is a possibly empty list of generic function metaobjects.

Description

This generic function returns the possibly empty set of those generic functions which have a method with specializer as a specializer. The elements of this set are generic function metaobjects. This value is maintained by the generic functions add-direct-method and remove-direct-method.

Methods

Method specializer-direct-generic-functions

(specializer eql-specializer) => generic-functions

Description

No behavior is specified for this method beyond that which is specified for the generic function.

specializer-direct-methods

Generic Function specializer-direct-methods

specializer => methods

Arguments and Values

  • specializer -- A specializer metaobject.
  • methods -- A possibly empty list of method metaobjects.

Arguments

The specializer argument is a specializer metaobject.

Values

The result of this generic function is a possibly empty list of method metaobjects.

Description

This generic function returns the possibly empty set of those methods, connected to generic functions, which have specializer as a specializer. The elements of this set are method metaobjects. This value is maintained by the generic functions add-direct-method and remove-direct-method.

Methods

Method specializer-direct-methods

(specializer eql-specializer) => methods

Description

No behavior is specified for this method beyond that which is specified for the generic function.

standard-instance-access

Function standard-instance-access

instance location => object

Arguments and Values

  • instance -- An object.
  • location -- A slot location.
  • object -- An object.

Arguments

The instance argument is an object.

The location argument is a slot location.

Values

The result of this function is an object.

Description

This function is called to provide direct access to a slot in an instance. By usurping the normal slot lookup protocol, this function is intended to provide highly optimized access to the slots associated with an instance.

The following restrictions apply to the use of this function:

  • The instance argument must be a standard instance (it must have been returned by allocate-instance (class standard-class)).

  • The instance argument cannot be an non-updated obsolete instance.

  • The location argument must be a location of one of the directly accessible slots of the instance's class.

  • The slot must be bound.

The results are undefined if any of these restrictions are not met.

update-dependent

Generic Function update-dependent

metaobject dependent &rest initargs => unspecified

Arguments and Values

  • metaobject -- A class or generic function metaobject. It is the metaobject being reinitialized or otherwise modified.
  • dependent -- An object. It is the dependent being updated.
  • initargs -- A list of the initialization arguments for the metaobject redefinition.

Arguments

The metaobject argument is a class or generic function metaobject. It is the metaobject being reinitialized or otherwise modified.

The dependent argument is an object. It is the dependent being updated.

The initargs argument is a list of the initialization arguments for the metaobject redefinition.

Values

The value returned by update-dependent is unspecified.

Description

This generic function is called to update a dependent of metaobject.

When a class or a generic function is reinitialized, each of its dependents is updated. The initargs argument to update-dependent is the set of initialization arguments received by reinitialize-instance.

When a method is added to a generic function, each of the generic function's dependents is updated. The initargs argument is a list of two elements: the symbol add-method, and the method that was added.

When a method is removed from a generic function, each of the generic function's dependents is updated. The initargs argument is a list of two elements: the symbol remove-method, and the method that was removed.

In each case, map-dependents is used to call update-dependent on each of the dependents. So, for example, the update of a generic function's dependents when a method is added could be performed by the following code:

(map-dependents generic-function
                #'(lambda (dep)
                    (update-dependent generic-function
                                      dep
                                      'add-method
                                      new-method)))

Methods

There are no specified methods on this generic function.

Remarks

See the Dependent Maintenance Protocol section for remarks about the use of this facility.

validate-superclass

Generic Function validate-superclass

class superclass => generalized-boolean

Arguments and Values

  • class -- A class metaobject.
  • superclass -- A class metaobject.
  • generalized-boolean -- A generalized boolean.

Arguments

The class argument is a class metaobject.

The superclass argument is a class metaobject.

Values

This generic function returns true or false.

Description

This generic function is called to determine whether the class superclass is suitable for use as a superclass of class.

This generic function can be called by the implementation or user code. It is called during class metaobject initialization and reinitialization, before the direct superclasses are stored. If this generic function returns false, the initialization or reinitialization will signal an error.

Methods

Method validate-superclass

(class class) (superclass class) => generalized-boolean

Description

This method returns true in three situations:

  1. If the superclass argument is the class named T,

  2. if the class of the class argument is the same as the class of the superclass argument or

  3. if the class of one of the arguments is standard-class and the class of the other is funcallable-standard-class.

In all other cases, this method returns false.

This method can be overridden.

Remarks

Defining a method on validate-superclass requires detailed knowledge of the internal protocol followed by each of the two class metaobject classes. A method on validate-superclass which returns true for two different class metaobject classes declares that they are compatible.

writer-method-class

Generic Function writer-method-class

class direct-slot &rest initargs => writer-method-class

Arguments and Values

  • class -- A class metaobject.
  • direct-slot -- A direct slot definition metaobject.
  • initargs -- A list of initialization arguments and values.
  • writer-method-class -- A class metaobject.

Arguments

The class argument is a class metaobject.

The direct-slot argument is a direct slot definition metaobject.

The initargs argument is a list of initialization arguments and values.

Values

The value returned is a class metaobject.

Description

This generic function is called to determine the class of writer methods created during class initialization and reinitialization. The result must be a subclass of standard-writer-method.

The initargs argument must be the same as will be passed to make-instance to create the writer method. The initargs must include :slot-definition with slot-definition as its value.

Methods