bindingOf question?

Peter van Rooijen peter at vanrooijen.com
Sun Nov 21 23:12:36 UTC 2004


Alexandre Bergel wrote:

>>>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.
> 
> 
> 
> Why the bindings contained in a environment should be access thought one class continained in this environment ?
> 
> I would rather see something like:
> 
> Behavior>>bindingsOf: aSymbol
>    binding := self methodDict bindingOf: aSymbol.

Hi Alexandre,

The lookup in question is for shared variables (pool variables, class 
variables, global variables), not methods. It is used at compilation 
time to create the correct bindings in the compiled method.

Cheers,

Peter

>    binding ifNotNil: [^binding].
> 
>    "Finally look higher up the superclass chain and fail at the end."
>    ^ superclass == nil
>        ifTrue: [nil]
>        ifFalse: [superclass bindingOf: aSymbol].
> 
> Alexandre
> 
> 
> 
>>>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