[E-Lang] Re: inheritance, delegation, mental models for beginners (was: down with `define' (was: newbie syntax: picayune points from a prejudiced programmer))
Marc Stiegler
marcs@skyhunter.com
Fri, 2 Mar 2001 13:39:30 -0700
> I think I would prefer that the superclass invoke the subclass's
> method.
Ahem. You just explained why I am so nuts about this topic. I guess I have
to thank you for making my point unintentionally. Delegation, which does not
do this, actually provides cleaner modularity, which leads with time to more
reliable maintenance. But it is very attractive, isn't it?
The parallels between this and the GOTO wars fought 20 years ago are eerie.
The way I propose to win this battle is the same way the war against the
GOTO statement was won.
First step: keep the inheritance/goto statement as a part of the language
(without requiring a special flag! :-) while delivering a much better
alternative in an attractive package. Early adopters/industry leaders will
create usage conventions that deprecate the bad old system. That is my goal
for E.
Next step (in the language that Dan points out is not Joule): cut the heart
out of inheritance, make it a funny lambda expression no real person would
use. But have it for the second-generation check box.
Third step: get rid of it completely because no one ever uses it in its
crippled form. I don't even think we've gotten to that third step with the
GOTO statement, have we? Doesn't Java still have one? If so, then E is
actually completing the journey on GOTO at long last, getting rid of it
completely (think how much fun we'd have arguing a requirement to have a
GOTO statement in E :-)
> When I said that I preferred delegation over inheritance I simply meant
> that I didn't want code re-use to imply subtyping. I also meant that
> I wanted to be free to re-use code from objects without necessarily
> having to deal with that object's class (which is a fine distinction
> that might actually be an empty distinction in E).
I believe you are correct,the distinction is empty.
--marcs