super super

Raab, Andreas Andreas.Raab at disney.com
Wed Feb 16 21:55:33 UTC 2000


Hi,

Since there seem to be quite some people speaking in favor of 'super super'
somebody has to speak against it ;-) I think there are good reasons *not* to
have a construct like 'super super'. The primary motivation for me is that
any such construct really breaks encapsulation since you are assuming
knowledge about unchanging behavior in the superclass(es). With 'super
super' you are explicitly bypassing specific inherited behavior for
something that should be refactored anyways (show me one example where
'super super' can not be refactored so that it's completely unneccessary).

It's somewhat different with a message send that should be performed in a
specific class - this one could be interpreted as "I want the point of view
of a specific class on the subject of the message" - e.g., if you want to
have the POV of Object on equality (which is identity) it might be
appropriate to say

	someObject perform: #= asSeenBy: Object with: anotherObject

Funny it looks like Wonderland here - but not really amazing because a 3D
system in many cases needs different reference frames. I was always
wondering why there is no real equivalent to this in any OOP system I've
seen so far. Specifying a reference class can also help to increase
polymorphism of messages since now you could say:

	aDictionary perform: #do: asSeenBy: Set with: aBlock

rather than using a separate method #associationsDo:

Just my $.02

  Andreas

> -----Original Message-----
> From: Norton, Chris [mailto:chrisn at Kronos.com]
> Sent: Wednesday, February 16, 2000 1:37 PM
> To: 'squeak at cs.uiuc.edu'
> Cc: recipient list not shown
> Subject: RE: super super
> 
> 
> Hi Yoshiki & friends.
> 
> On Feb. 16, 2000 2:21 PM, Yoshiki Ohshima 
> [ohshima at is.titech.ac.jp] wrote:
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> <snip> "When I was writing #addCustomMenuItems:hand: for a 
> morph, I wish I
> could write something like
> 
>    super super addCustomMenuItems: aCustomMenu hand: aHandMorph.
> 
> at the top of the method.  The intention was to bypass the superclass'
> #addCustomMenuItems but want to call the supersuperclass' one 
> before adding
> my own menu items."  <snip>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> I have to admit that I've always wanted a super super 
> construct.  I have had
> several (admittedly poorly factored) cases where I wanted to 
> get back to the
> original implementation of a method (Object>>something) and I 
> was stuck
> cutting & pasting the code into my subclass.
> 
> Perhaps what is needed is an easy way to directly reference a 
> superclass
> method?  I can imagine that 3 or 4 supers in a row would get 
> tedious, but
> what about something that worked like this:
> 
>    self allSuperclasses first doSomething
> 
> maybe:
> 
>    self performSuperclassMethod: #doSomething using: Object
> 
> An intriguing subject.  Cheers!
> 
> ---==> Chris
> 





More information about the Squeak-dev mailing list