[squeak-dev] Urgent: how to define a global?
Levente Uzonyi
leves at elte.hu
Wed Oct 29 20:43:32 UTC 2014
On Wed, 29 Oct 2014, Chris Muller wrote:
> Trying to debug a server, need to define a global OrderedCollection
> "X" which I want to put debugging objects into. In a workspace, I
> type:
>
> X := OrderedCollection new
>
> System asks me to correct or define a global. I choose to define a global.
>
> But I still cannot access X. It keeps asking me to correct or define
> a global. Yippee, great thing to happen at 4am when you just need to
> debug something!
>
> Digging in shows that when I try to access X, it ends up looking in
> Smalltalk environment 'bindings' IdentityDictionary, but when I
> defined X, it put the binding #X=>nil into Smalltalk environment
> 'declarations' only.
>
> I don't know what 'declarations' vs. 'bindings' are and I don't care,
> I just need to be able to define the global, could someone pelase tell
> me the proper fix?
This has always worked for me:
Smalltalk at: #X put: OrderedCollection new.
>
> a) Defining X should put it in 'bindings' instead of 'declarations'?
IIRC bindings are all bindings available in the Environment, while
declarations are the locally declared bindings. So it should be present in
both of them. Howeverbindings is currently filled up lazily, that's why
your binding might be missing from it.
> b) Accessing X should access from 'declarations' instead of 'bindings'?
No. See above why.
> c) Defining X should put it in BOTH 'declarations' and 'bindings'?
Yes. See above why. :)
Levente
>
>
More information about the Squeak-dev
mailing list
|