Initialization of Generic Function Metaobjects

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

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

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

During initialization or reinitialization, each initialization argument is checked for errors and then associated with the generic function metaobject. The value can then be accessed by calling the appropriate accessor as shown in the table below. (FIXME:insert anchor).

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. The section ends with a set of restrictions on portable methods affecting generic function 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 generic function metaobject classes. Portable programs are free to define default initialization arguments for portable subclasses of the class generic-function.

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.

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:

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

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 generic function 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 generic-function. Other portable methods on these generic functions are not affected by these restrictions.

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