[Survey] About the cognitive surcharge of super
Stephane Ducasse
ducasse at iam.unibe.ch
Fri Sep 6 18:30:05 UTC 2002
Hi ian
this is fun because squeakers are much better than the oo expert (j..)
I know ;).
Just a point. The fact that class is not sent is not really good. I
would say that ideally it should be bytecoded only when class is not
redefined in the class or one of its superclasses.
Redefining of class let me implement shadow classes (instance of
behavior) acting as metobject (as in CodA) transparently in VW. Without
the possibility to redefine class I as well as codA could not have made
it in a so nice way.
Stef
On vendredi, septembre 6, 2002, at 07:15 PM, Ian Piumarta wrote:
> Steph,
>
> On Fri, 6 Sep 2002, Stephane Ducasse wrote:
>>
>> MyClass>>test1
>> ^ super == self
>
> The only difference betwen super and self is related to where lookup
> starts -- the receiver is identical in both cases. That leaves only
> two
> possibilities:
>
> 1) if you defined MyClass to have nil as superclass (or to be a
> subclass
> of some class that does not have Object in the superclass chain
> someplace) then you get message not understood (#== is not found
> in lookup).
>
> 2) if Object is somewhere above MyClass then the answer is true.
>
>> MyClass>>test2
>> ^ self class == super class
>
> Self and super are the same object. The result _has_ to be true. (The
> same observation about superclasses and #doesNotUnderstand: applies
> here
> too, but only in the send to super. [The send of #class to self
> doesn't
> cause a message send at all -- the VM fetches the class directly when
> it
> sees the special send bytecode. In the send to super, the message
> really
> is sent and a primitive in Object or ProtoObject or wherever fetches
> the
> class of the receiver, which is self.])
>
> Regards,
>
> Ian
>
>
Dr. Stéphane DUCASSE (ducasse at iam.unibe.ch)
http://www.iam.unibe.ch/~ducasse/
"if you knew today was your last day on earth, what would you do
different? ... especially if, by doing something different, today
might not be your last day on earth" Calvin&Hobbes
More information about the Squeak-dev
mailing list
|