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

Re: Method lookup search



Danny writes:
> [stuff about how current lookup scheme isn't always cooperative]

We've been thinking about this problem too.  In our paper, "Parents are
shared parts of objects: inheritance and encapsulation in Self" (in The
Self Papers), we mention another example of this problem, with mixins,
in Section 2.5.1, "Self's priorities are too strong."  Mixins shouldn't
have parents, because a mixin is usually inherited with high priority,
and thus will short circuit the lookup undesirably:

                         some-default-traits-object
                                /         \
                           object P    mixin M
              (low priority) ** \         / * (high priority)
                                 an-object

> It seems to me that you want the ancestors to be searched in an order
> which conforms to the partial ordering derived from the inheritance
> hierarchy (normally a directed acyclic graph (DAG)):
>
>    If a inherits from b, then search a before b.

We agree.  From the paper:

"We are considering altering the lookup rules to always search children
 before their ancestors, even if the children are on lower-priority paths
 than the ancestors."

In fact, we've been thinking about eliminating priorities altogether, though
that is still under discussion.  However, we're pretty sure that
ordered-upto-join inheritance semantics is the right thing.

Bay