Why do superclassSend ensureBehaviorHash:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Why do superclassSend ensureBehaviorHash:

Nicolas Cellier
 
Hi,
I see that superclassSend sends:
    objectMemory ensureBehaviorHash: superclass.
and just after it does
    lkupClassTag := objectMemory classTagForClass: superclass.

But classTagForClass:  is doing the same as above:
    <api>
    self assert: (coInterpreter addressCouldBeClassObj: classObj).
    ^self ensureBehaviorHash: classObj

So we are sending ensureBehaviorHash: twice...
It sounds un-ncecessary or is there a tricky reason to this?

Moreover, it sounds like ensureBehaviorHash: will begin with
    self assert: (coInterpreter addressCouldBeClassObj: aBehavior).

So again, we are asserting twice the same thing, aren't we?
Reply | Threaded
Open this post in threaded view
|

Re: Why do superclassSend ensureBehaviorHash:

Eliot Miranda-2
 
Hi Nicolas,

On Tue, Apr 26, 2016 at 2:43 PM, Nicolas Cellier <[hidden email]> wrote:
 
Hi,
I see that superclassSend sends:
    objectMemory ensureBehaviorHash: superclass.
and just after it does
    lkupClassTag := objectMemory classTagForClass: superclass.

But classTagForClass:  is doing the same as above:
    <api>
    self assert: (coInterpreter addressCouldBeClassObj: classObj).
    ^self ensureBehaviorHash: classObj

So we are sending ensureBehaviorHash: twice...
It sounds un-ncecessary or is there a tricky reason to this?

Moreover, it sounds like ensureBehaviorHash: will begin with
    self assert: (coInterpreter addressCouldBeClassObj: aBehavior).

So again, we are asserting twice the same thing, aren't we?

Yes.  Good catch.  The send in superclassSed is clearly superfluous; but I would change the method to comment that classTagForClass: ensures there is a hash.



--
_,,,^..^,,,_
best, Eliot