[Tutor] Why super does not work !
Alan Gauld
alan.gauld at btinternet.com
Wed Jan 19 19:17:57 CET 2011
"Steven D'Aprano" <steve at pearwood.info> wrote
> I'm sorry, but I don't believe you :/ If it "just works" in Lisp,
> why
> > does Lisp allow you to override the default linearization?
>
At 2:00am last night I wrote a long explanatory reposte then
discovered my wife's Netbook wouldn'ty let me post it! Now
I can't be bothered retyping it all so I'll summarise! :-)
MI is harder than SI - always.
Lisp makes it as easy as it can get and works well enough
that for the past 20+ years its been the stabndartd OOP idiom
in Lisp. But OOP is not the most common idiom in the Lisp
community so we are not dealing with typical OOP programmers.
I used Lisp MI for about 5 years and had no issues that
could not be addressed using the standard Lisp tools
(redefining the linearization is one such tool.but not one used
often) The definition of before/after and around specifiers is
the one that is used most.in my experience.
Diamonds are usually avoided (you can make one if you work
hard at it) but mostly Lisp pulls all parents into a suingle set
so there are no duplicate paremts but the order can be a
bit "random"! This is less of an issue that it sounds because
of the before/after safeguards.
So I'm not recommending wholesale use of MI simply saying
that it is a valid and convenient tool in languages that expect it
(Eiffell is another where I've had success with MI - but sadly
less so with the standard library - another tale...)
As to my own experience with super - I just can't find cases
where it works with MI and, although not recommended, using
explicit calls to the superclasses has worked in most cases.
Maybe if I was writing production code in Python I'd be less
gung ho, but I only use Python for tools and prototyping so it
hasn't bitten me so far! :-)
Maybe its no coincidence that Smalltalk has always
resisted adding MI. Even an experimental branch with
MI seems to have died out :-)
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list