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

CPL etc

    Date: 30 Jan 87  2218 PST
    From: Dick Gabriel <RPG@SAIL.STANFORD.EDU>
    ....I have some questions about whether we think it is intuitive:

    (defclass c1 (top) ())
    (defclass c2 (top) ())
    (defclass c3 (top) ())
    (defclass d1 (c1 c2) ())
    (defclass d2 (c1 c3) ())
    (defclass e1 (d1 d2) ())

    At some point Danny mentioned that the ``right'' order for this is
    (E1 D1 D2 C1 C2 C3 TOP) 

    The new algorithm (and New Flavors, I think) produces
    (E1 D1 D2 C1 C3 C2 TOP) 

There's no way to avoid breaking up the superclasses of either D1 or D2,
so no order is going to be intuitive by Danny's rule of not breaking up
superclasses (equivalently, hiding the implementation of a component class
as a single class or a tree of superclasses).  The new algorithm keeps D2
together and breaks up D1.  The previous order breaks them both up.  Not
much difference in my opinion.

    Some people might have been confused by Moon's description. It read:

    ``When topological sort finds multiple candidates to go in next, choose the
    candidate that has a direct subclass rightmost in the class precedence list
    computed so far.  ***If that subclass has more than one direct superclass
    among the candidates, take the superclass that is most specific according
    to the subclass's local precedence order.***''

    The condition described in the sentence between the asterisks cannot
    happen, so you shouldn't try to understand it.

Oh, right, this only happens if you add the extension that the local
precedence order of a class can be a partial order rather than a total
order.  We have that in Flavors, and it comes in handy, but I'm not
proposing to standardize on it at this time.

    I think that in worrying about the CPL we have to keep in mind that most
    people will operate under the following model: The direct superclasses
    mentioned in the DEFCLASS form and their relative order are important. The
    system will then provide some arbitrary total order, and the program will
    have to be massaged until it works - simply because no one can understand
    the algorithm. This is the model that KDO will have; KDO is no wimp.

KDO is certainly not a wimp, but he is known for massaging things until they
work instead of understanding them.

    Here is a simple example, which many of you have seen before....
    ....the user's intuition might be reasonable. He sees that the Turtle noseup-method
    is good, and that the Green-animals blush method is good, so he inherits from
    both. But he has to mention Turtles and Green-animals in some order. If he
    mentions them in the above order, he gets the wrong blush-method; if he reverses
    them he gets the wrong noseup-method.

I think you're mistaken.  Animate-things is less specific than both
turtles and green-animals, in your diagram, so there is no danger of
getting the wrong method.  In fact the order of the direct superclasses
turtles and green-animals doesn't affect the applicable methods at all.

    In any event, what we are doing by defining the CPL computation as we 
    are is to provide a mechanism for people to curse the standard.

Is this based on the above mistaken example, or on other considerations?