Simberon Design Minute
 

Cascading to Super

I was looking at some Smalltalk initialization code and saw a strange initialize method. It read super initialize; initializeData. This method raises an interesting question - what's the result of cascading a message to super? Super means that the following message is to be sent to the same receiver as self but with the search starting in the class above the one where the current method is defined. In order words, it's the same object as self with a different method lookup technique. Does this technique still apply after a cascade or would the cascaded message work the same way as sending a message to self? I tried it in a couple dialects of Smalltalk and found that it used the super lookup algorithm for the message after the cascade. Although this may make sense, I would never want to depend on this to work the same on all Smalltalks. I'd rather avoid cascading to super and use a separate statement which would be clearer.

Download