Thomas F. Burdick wrote:
> Your mixin should also have a metaclass of
> funcallable-standard-class. Unless I'm forgetting something, it's not
> guaranteed anywhere that you can mix f-s-c and standard-class.
Well, I think it's not forbidden anywhere in the MOP: It says
1) "Instances of the class FUNCALLABLE-STANDARD-CLASS support
multiple inheritance and reinitialization."
2) "Direct Superclass Relationships Among The Specified Metaobject Classes
...
FUNCALLABLE-STANDARD-OBJECT - (STANDARD-OBJECT FUNCTION)"
3) "The class STANDARD-OBJECT is the default direct superclass of the
class STANDARD-CLASS. When an instance of the class STANDARD-CLASS
is created, and no direct superclasses are explicitly specified, it
defaults to the class STANDARD-OBJECT. In this way, any behavior
associated with the class STANDARD-OBJECT will be inherited, directly
or indirectly, by all instances of the class STANDARD-CLASS. A
subclass of STANDARD-CLASS may have a different class as its default
direct superclass, but that class must be a subclass of the class
STANDARD-OBJECT.
The same is true for FUNCALLABLE-STANDARD-CLASS and
FUNCALLABLE-STANDARD-OBJECT."
4) "(VALIDATE-SUPERCLASS (class CLASS) (superclass CLASS))
This method returns true in three situations:
- If the superclass argument is the class named T,
- if the class of the class argument is the same as the class of the
superclass argument, or
- if the class of one of the arguments is STANDARD-CLASS and the class
of the other is FUNCALLABLE-STANDARD-CLASS."
To me, 1) means that when a class is instance of FUNCALLABLE-STANDARD-CLASS,
it can have multiple direct superclasses. 2) means that for instances of
FUNCALLABLE-STANDARD-CLASS, inheriting from STANDARD-OBJECT and FUNCTION
is a normal behaviour. And 3) is irrelevant because it talks only about
the case that no direct superclasses were explicitly specified.
Since every FUNCALLABLE-STANDARD-CLASS instance inherits from STANDARD-OBJECT,
why would it have problems inheriting from a subclass of STANDARD-OBJECT ?
And finally, the third case of 4) shows that I shouldn't even need to
define a method on VALIDATE-SUPERCLASS myself: the default method should
already return true but doesn't in SBCL.
> Your mixin should also have a metaclass of funcallable-standard-class.
That's contrary to the idea of "mixin". A mixin is a collection of slots
and behaviour that can be reused anywhere in the class hierarchy.
Bruno
|