[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: two questions about standard-class
A class is considered initialized if its direct superclasses
are known. I don't understand this; how can a class be defined
without stating what its direct superclasses are?
This is a NON-feature that was removed at the meeting. The old idea was to
represent a forward-referenced-class as a class without any direct superclasses.
It was to have been defined by using the functional level
(add-named-class (symbol-class 'standard-class))
where direct-superclasses were not provided. But we decided to have
aforward-referenced-class. CLOS now specifies that direct-superclases be known
at creation time for a standard-class.
I was also confused about class-default-direct-superclasses.
I understand what it is supposed to do (the method for
standard-class ensures that standard-object is included in the
CPL). The documentation (page 3-14 on my draft) says if there are
any supplied superclasses, this method returns the list of supplied
superclasses and doesn't add standard-object to that list. If
there are no supplied superclasses, this method returns a list
containing standard object.
The goal of this approach seems to be not to require
standard-object to be a direct superclass of each class (otherwise
the method would always add standard-object to the list). The
assumption seems to be that if there is a supplied superclass, it
already has standard-object in its CPL. Does this really work?
What if you define a class and specify T to be the only direct
superclass?
The intention is that this should be made to work. It requires the following
not all of which are spelled out explicitly in the writing.
1) Any class in the kernel that is implemented as a standard-class must have
standard-object in its class-precedence list. The only exception is the class
T, if that class is implemented as a standard-class.
2) It is not legal to specify T as a direct superclass of a standard class.
3) In the kernel, the only legal superclass of a standard-class is a
standard-class.
Since all existing standard-classes that can be used as a superclass have
standard-object in their class-precedence-list, if
class-default-direct-superclasses provides standard-object as a
direct-supreclass when no direct-superclasses are specified, this invariant
continues to hold.
Of course, it is possible to program around this restriction using the MOP.
[Whatever the answer to the question, if I stated the goal of
the approach correctly, it should probably be written down in the
documentation.]
Right.