Package: closer-mop
Generic Function ensure-class-using-class
Lambda List
ensure-class-using-class (class name &rest args &allow-other-keys)
Arguments
Return Value
The result is a class metaobject.
Details
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:
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 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.
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 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 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
ensure-class-using-class ((class class) name &key :metaclass :direct-superclasses &allow-other-keys)
ensure-class-using-class ((class forward-referenced-class) name &key :metaclass :direct-superclasses &allow-other-keys)
ensure-class-using-class ((class null) name &key :metaclass :direct-superclasses &allow-other-keys)
This method implements the behavior of the generic function in the case where the class argument is a class.
This method can be overridden.
This method can be overridden.
ensure-class-using-class ((class forward-referenced-class) name &key :metaclass :direct-superclasses &allow-other-keys)
This method implements the behavior of the generic function in the case where the class argument is a forward referenced class.
ensure-class-using-class ((class null) name &key :metaclass :direct-superclasses &allow-other-keys)
This method implements the behavior of the generic function in the case where the class argument is nil.