[self-interest] parent slot lookups
Jecel Assumpcao Jr
jecel at merlintec.com
Mon Apr 7 22:59:16 UTC 2003
On Sunday 06 April 2003 02:26, Steve Dekorte wrote:
> When Self follows an inheritance chain, will it activate methods in
> parent slots? That is, if set an Object to have a parent slot
> containing a method(instead of another object) that returns the
> object that I want to lookup to continue in, will it work?
Dave has already answered "no", but I would like to consider the
practical complications of such a scheme.
Does the method take any arguments? If so, when invoked from the lookup
routine instead of a regular program then what will that argument be?
If not, then won't the method always reply the same object (same thing
as a data slot)?
You might think that a no argument method can return different values
since it can send further messages (which is correct) but then you run
into a different problem: what if these further messages also need
lookup via the very "parent method" we are trying to evaluate?
And all this supposing that each object has a single parent data/method
slot. With multiple parents there will be a fantastic number of ways
that things can be combined and it will nearly always be impossible to
understand what is going on.
A far better way to organize things is to create a proper reflective
layer. See CoDA for Smalltalk as an example in which seven different
kinds of meta-objects allow you to change any aspect of message passing
and inheritance in a modular and understandable way:
P.S.: thanks for the "naked objects" link - it is actually more similar
to the eToys viewers in Squeak than outliners in Self
More information about the Self-interest