Method lookup search

Bay-Wei Chang bay
Thu Apr 4 02:13:45 UTC 1991

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:

                                /         \
                           object P    mixin M
              (low priority) ** \         / * (high priority)

> 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.


More information about the Self-interest mailing list