bindingOf question?

Andrew Tween amtween at hotmail.com
Sat Nov 20 12:36:41 UTC 2004


----- Original Message ----- 
From: "stéphane ducasse" <ducasse at iam.unibe.ch>
To: "The general-purpose Squeak developers list"
<squeak-dev at lists.squeakfoundation.org>
Sent: Friday, November 19, 2004 4:05 PM
Subject: bindingOf question?


> Hi all
>
> I'm wondering why the definition of bindingOf: is the following one:
>
> Behavior>>bindingOf: varName
> "Answer the binding of some variable resolved in the scope of the
> receiver"
> ^superclass bindingOf: varName
>
> and not something more like that.
>
>        binding := self environment bindingOf: aSymbol.
> binding ifNotNil:[^binding].
>
> "Finally look higher up the superclass chain and fail at the end."
> superclass == nil
> ifTrue: [^ nil]
> ifFalse: [^ superclass bindingOf: aSymbol].
>
> It seems to me that the current Behavior>>bindingOf is bogus.

I don't believe that the Behavior>>bindingOf: method is ever executed.
bindingOf: is reimplemented in both Class and MetaClass, and neither of
those does a 'super bindingOf: '.
I put a 'self halt' into Behavior>>bindingOf: , and didn't get a Debugger.

Having said that, there are 2 subclasses of Behavior which 'might' need the
Behavior>>bindingOf: method, namely, Oop and Unsigned.
These classes appear to be part of VMMaker, but I don't know whether you
would ever, meaningfully, send bindingOf: to instances of those classes.

So, I suspect that Behavior>>bindingOf: can be safely deleted, or changed to
bindingOf: varName self subclassResponsibiliy'

Cheers,
Andy


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.792 / Virus Database: 536 - Release Date: 10/11/2004



More information about the Squeak-dev mailing list