[Openmcl-devel] mop issue
gb at clozure.com
Sun Oct 3 03:41:09 PDT 2004
On Sun, 3 Oct 2004, marco wrote:
> let me rephrase the question: i'd like to write a metaclass which
> ensures that all instances of the metaclass have super on their
> c-p-l. should the user of defclass not put super in the
> direct-superclasses, nor provide a direct-superclass which has super
> on it's c-p-l, i would like super to be the first element (after the
> class itself) of the c-p-l.
The MOP's description of COMPUTE-CLASS-PRECEDENCE-LIST (AMOP p 173)
"All methods on this generic function must compute the class precedence
list as a function of the ordered direct superclasses of the superclasses
of CLASS. The results are undefined if the rules used to compute the
class precedence list depend on any other factors."
I read that to say that methods can change the ordering of the ordered
direct superclasses, but can't (portably) introduce arbitrary classes
into its result.
> on cmucl and sbcl this code works as i expect it to work, but maybe
> i'm just lucky (i haven't tried on other implementations).
If my interpretation is correct - and the "results are undefined" -
then working as you expect and complaining about inconsistency are
both legitimate results. I'm not sure offhand what the results would
be if this interpretation is correct and the complaint was removed
(i.e., whether other things expect the transitive direct-superclasses
and the CPL to be directly related.)
[I haven't tried too hard to decode CCL::COMPUTE-CPL; I'm assuming
that the "inconsistency" it's complaining about is that a superclass
has a class on its CPL that isn't a transitive superclass of that
class. It's be nice if CCL::COMPUTE-CCL was a little more willing/able
to describe the inconsistency it's complaining about ...]
> -- -Marco
More information about the Openmcl-devel