[Survey] About the cognitive surcharge of super

Richard A. O'Keefe squeak-dev at lists.squeakfoundation.org
Mon Sep 9 01:07:13 UTC 2002


Stephane Ducasse <ducasse at iam.unibe.ch> asked about these methods:

	MyClass>>test1
		^ super == self
	
OK, this sends the message #== with argument self to the current
class, starting lookup in the parent class.  Since #== isn't redefined
(in Squeak it comes from ProtoObject), you'll get exactly the same
result as self==self.

My understanding was that ^self == super is not allowed;
I was very surprised to find that Squeak allows it.

	MyClass>>test2
		^ self class == super class
	
This sends the message #class to super; which is just like sending it
to self except for starting one level higher in the hierarchy.
Since #class is defined in Object and nowhere redefined, it gives
exactly the same result as (self class), except of course in a bare
Object.  If you stick this #test2 method in Object and do
    Object new test2
you get the predictable MessageNotUnderstood.

"super" strikes me as a simplification of Simula's "qua".

	I found that lot of people were confused by the second test. I have the 
	impression that super is cognitively overloaded and should have be be 
	called overriden or callNextMethod as in clos.

Some languages have used 'inherited', but
    self class == inherited class
would probably be even more confusing.




More information about the Squeak-dev mailing list