bindingOf question?

Alexandre Bergel bergel at iam.unibe.ch
Sun Nov 21 14:18:13 UTC 2004


> > 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.
   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

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.iam.unibe.ch/~bergel
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



More information about the Squeak-dev mailing list