Package object-class
Description
All symbols from this package should normally be explicitly qualified, such as object-class:class
.
Don't (:use)
!
object-class
ensures that special subclasses of standard-object
cluster right in front of standard-object in the class precedence list.
Using a special subclass of standard-object in instances of a metaclass is a well-known MOP design pattern, as is automatically inserting the needed class in the direct superclasses (since the class precedence list cannot simply add classes that were not declared as direct superclasses).
But design patterns are for when you have run out of language, and we didn't run out of language because this is Common Lisp we're talking about, hence this library.
All symbols from this package should normally be explicitly qualified, such as object-class:class
.
Don't (:use)
!
compatible-metaclasses:standard-class
See description for object-class:class
.
compatible-metaclasses:standard-class
Classes that are instances of this class push back classes that are instances of object-class:object-class
towards the back (to just before standard-object or funcallable-standard-object) in their class precedence list.
(class object-class:class
) => precedence-list
Calls object-class:push-back-to-target
with the following arguments:
object-class:object-class
;(nreconc to-push-back rest)
if rest is true, else signals an error reporting that neither standard-object nor funcallable-standard-object were found in the class precedence list.list pushbackp-function targetp-function &optional target-callback => result
Let to-push-back be the empty list.
First, traverse list up to the first element for which targetp-function returns true, or to the end of the list if there is no such element.
During this traversal, if pushbackp-function is true of the element, then push it into to-push-back (in reverse order) and remove it from list, else copy it. This processing ends right before the target if it is present.
Second, concatenate the copied results from the first step to the result of calling target-callback with to-push-back and the rest of the list, which has the target as its first element if the target was present in the list.
class-options:options-mixin, compatible-metaclasses:standard-class
Classes that are instances of this class automatically append the list of classes returned by calling (
to the end of the class' direct superclasses.object-class:autosuperclass
class)
(class object-class:autosuperclass
) &key direct-superclasses => canonicalized-options
If we are initializing or direct-superclasses has been supplied, then prepend :direct-superclasses (append direct-superclasses
to the results of calling the next method.(
)object-class:autosuperclass
class)
class => classes
Returns the list of classes that should be automatically appended to the end of the list of direct superclasses for this class.
Define a method on this generic function specializing on your metaclass to return the classes you want to append, usually one.
(class object-class:autosuperclass
) => autosuperclass
Returns nil
.