[E-Lang] Re: inheritance, delegation, mental models for beginners
zooko@zooko.com
zooko@zooko.com
Sun, 04 Mar 2001 14:12:31 -0800
MarkM wrote:
> Hi guys, I'm not sure what you're each saying here. I think we all agree on
> the meaning of "delegation" by itself: A delegates to B is A forwards all
> messages it doesn't directly understand to B. This is represented directly
> in E as
>
> def A {
> to ... { ... }
> to ... { ... }
> ...
> delegate { B }
> }
>
> There is no implication that B even has a reference to A, much less that it
> invokes A to give it a change to override behavior defined by B.
>
> Chip, I believe you're saying that we should simply stop here and say "this
> is inheritance". Dean, I think you think you're agreeing with Chip, but I'm
> not at all sure you'd agree with what I think Chip is saying (whether Chip
> is actually saying it or not. Chip?)
>
> The Treaty of Orlando, as well as the inheritance you designed for Vulcan,
> I'll call "dynamic inheritance" to distinguish it from E's "static
> inheritance". However, both are built as a pattern of delegation involving
> multiple simple delegations, and both have B give A a chance to override
> default behaviors in B. This is indeed "inheritance *by* delegation", as
> opposed to what I take Chip to be saying, which is "inheritance is delegation".
Whoops -- I see that `dynamic inheritance' is already taken (as I should have
realized from _tToO_). Darn.
I understand that `inheritance' is the wrong word for this feature, but based on my
reading of "The Treaty of Orlando", `delegation' is equally a wrong word.
(I realize that the dynamic, explicit, and fine-grained nature of E `delegation'
makes it have more in common with _tToO_ `delegation' than with _tToO_
`inheritance', but along the axis of encapsulation vs. extension of the
superclass, it is neither _tToO_'s `inheritance' nor `delegation'.)
How about "Encapsulated Inheritance" or "Safe Inheritance"?
You could, for example, provide different keywords like `extend' and `reuse'
instead of `inherit' and `delegate', and describe both of them as inheritance, and
the first as "extension inheritance" and the second as "safe inheritance".
Regards,
Zooko