[Survey] About the cognitive surcharge of super

Stephan Rudlof squeak-dev at lists.squeakfoundation.org
Sat Sep 7 05:59:00 UTC 2002


Travis Griggs wrote:

<snipped>

> One of my favorite about the first example, is that it doesn't 
> transmute. I wonder a students answer to the following would be:
> 
> "Given
> 
> methodA
> 	^super == self
> 
> methodB
> 	^self == super
> 
> Would these return the same result?"
> 
> Most students would probably say "well it depends", before they'd 
> realize that methodB just won't compile.
> 

They compile both. At least in Squeak 3.2. Bytecodes of the latter:

5 <70> self
6 <70> self
7 <C6> send: ==
8 <7C> returnTop



Greetings,

Stephan

-- 
Stephan Rudlof (sr at evolgo.de)
   "Genius doesn't work on an assembly line basis.
    You can't simply say, 'Today I will be brilliant.'"
    -- Kirk, "The Ultimate Computer", stardate 4731.3




More information about the Squeak-dev mailing list