[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CLOS: precedence of classes



Joerg Hoehle <hoehle@inf-wiss.uni-konstanz.de> asks:

> what's wrong with the following
> (defclass class1 () ())
> (defclass class2 (class1) ())
> (defclass class3 (class1 class2) ())

The CLOS rules for determining the effective method of a generic function
rely on the fact that if B is a subclass of A, then the class precedence list
of A is contained in the class precedence list of B *in* *that* *order*.

In your example, the CPL of class3 would have to contain (class2 class1)
- because this is the CPL of class2 - and would have to contain
(class3 class1 class2) - because that are the direct superclasses you
specified -. Obviously you can't have both.

                    Bruno Haible
                    haible@ma2s2.mathematik.uni-karlsruhe.de