[Openmcl-devel] class precedence list

Gary Byers gb at clozure.com
Tue Jun 17 05:09:05 PDT 2008



On Tue, 17 Jun 2008, Arthur W Cater wrote:

> Loading the following:
>
> ; -----
> (defclass mymix () ())
>
> (defclass mysuper (mymix) ())
>
> (defclass myclass (mymix mysuper) ())
> ; -----
>
> causes an error
>> Error: Inconsistent superclasses for #<STANDARD-CLASS MYCLASS>
>> While executing: CCL::COMPUTE-CPL, in process Listener(5).

I'm not sure that it sheds any more light on the question than what
people have already offered, but this case is similar to an example
given in section 4.3.5.2 of the spec:

"Examples of Class Precedence List Determination
[...]

It is possible to write a set of class definitions that cannot be
ordered. For example:

  (defclass new-class (fruit apple) ())

  (defclass apple (fruit) ())

The class fruit must precede apple because the local ordering of
superclasses must be preserved. The class apple must precede fruit
because a class always precedes its own superclasses. When this
situation occurs, an error is signaled, as happens here when the
system tries to compute the class precedence list of new-class."

This example is saying something like "an instance of NEW-CLASS
is primarily a FRUIT and secondarily an APPLE, and an APPLE is
a kind of FRUIT."  That's essentially the same kind of cirularity
that exists in your example.




More information about the Openmcl-devel mailing list