Urgent: how to define a global?

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

Urgent: how to define a global?

Chris Muller-4
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?

  a) Defining X should put it in 'bindings' instead of 'declarations'?
  b) Accessing X should access from 'declarations' instead of 'bindings'?
  c) Defining X should put it in BOTH  'declarations' and 'bindings'?

Reply | Threaded
Open this post in threaded view
|

Re: Urgent: how to define a global?

Nicolas Cellier
I've asked several questions about this a few months ago (dig squeak-dev if you wish, i'm in a hurry...)
No answer.
You made an effort to comment the classes, but Colin did completely change the implementation without updating the comment...
Now who knows what's in the mind of the conceptor?
It's like the fresh environment is abandonware...


2014-10-29 19:53 GMT+01:00 Chris Muller <[hidden email]>:
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?

  a) Defining X should put it in 'bindings' instead of 'declarations'?
  b) Accessing X should access from 'declarations' instead of 'bindings'?
  c) Defining X should put it in BOTH  'declarations' and 'bindings'?




Reply | Threaded
Open this post in threaded view
|

Re: Urgent: how to define a global?

Levente Uzonyi-2
In reply to this post by Chris Muller-4
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

>
>

Reply | Threaded
Open this post in threaded view
|

Re: Urgent: how to define a global?

Nicolas Cellier
In reply to this post by Nicolas Cellier
If someone can propose partial answers, it will benefit to the environment science

2014-10-29 20:21 GMT+01:00 Nicolas Cellier <[hidden email]>:
I've asked several questions about this a few months ago (dig squeak-dev if you wish, i'm in a hurry...)
No answer.
You made an effort to comment the classes, but Colin did completely change the implementation without updating the comment...
Now who knows what's in the mind of the conceptor?
It's like the fresh environment is abandonware...


2014-10-29 19:53 GMT+01:00 Chris Muller <[hidden email]>:
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?

  a) Defining X should put it in 'bindings' instead of 'declarations'?
  b) Accessing X should access from 'declarations' instead of 'bindings'?
  c) Defining X should put it in BOTH  'declarations' and 'bindings'?





Reply | Threaded
Open this post in threaded view
|

Re: Urgent: how to define a global?

Chris Muller-3
Thanks guys, those both helped.  After defining X I found I could do a
"Smalltalk importSelf" to get it copied into the 'bindings'
Dictionary.

My image is only slightly old but now I see I can define a global just
fine in a trunk image so maybe I'll try to see what the difference
that it works there but not in mine if it happens again..

On Wed, Oct 29, 2014 at 5:06 PM, Nicolas Cellier
<[hidden email]> wrote:

> So after some digging i found those questions aimed at resolving failing
> tests
>
> http://lists.squeakfoundation.org/pipermail/squeak-dev/2014-May/178411.html
> http://lists.squeakfoundation.org/pipermail/squeak-dev/2014-April/177744.html
>
> If someone can propose partial answers, it will benefit to the environment
> science
>
> 2014-10-29 20:21 GMT+01:00 Nicolas Cellier
> <[hidden email]>:
>>
>> I've asked several questions about this a few months ago (dig squeak-dev
>> if you wish, i'm in a hurry...)
>> No answer.
>> You made an effort to comment the classes, but Colin did completely change
>> the implementation without updating the comment...
>> Now who knows what's in the mind of the conceptor?
>> It's like the fresh environment is abandonware...
>>
>>
>> 2014-10-29 19:53 GMT+01:00 Chris Muller <[hidden email]>:
>>>
>>> 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?
>>>
>>>   a) Defining X should put it in 'bindings' instead of 'declarations'?
>>>   b) Accessing X should access from 'declarations' instead of 'bindings'?
>>>   c) Defining X should put it in BOTH  'declarations' and 'bindings'?
>>>
>>
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Urgent: how to define a global?

Levente Uzonyi-2
On Thu, 30 Oct 2014, Chris Muller wrote:

> Thanks guys, those both helped.  After defining X I found I could do a
> "Smalltalk importSelf" to get it copied into the 'bindings'
> Dictionary.

#importSelf is not what you want do, because that'll add the same policy
to your environment again.

Levente

>
> My image is only slightly old but now I see I can define a global just
> fine in a trunk image so maybe I'll try to see what the difference
> that it works there but not in mine if it happens again..
>
> On Wed, Oct 29, 2014 at 5:06 PM, Nicolas Cellier
> <[hidden email]> wrote:
>> So after some digging i found those questions aimed at resolving failing
>> tests
>>
>> http://lists.squeakfoundation.org/pipermail/squeak-dev/2014-May/178411.html
>> http://lists.squeakfoundation.org/pipermail/squeak-dev/2014-April/177744.html
>>
>> If someone can propose partial answers, it will benefit to the environment
>> science
>>
>> 2014-10-29 20:21 GMT+01:00 Nicolas Cellier
>> <[hidden email]>:
>>>
>>> I've asked several questions about this a few months ago (dig squeak-dev
>>> if you wish, i'm in a hurry...)
>>> No answer.
>>> You made an effort to comment the classes, but Colin did completely change
>>> the implementation without updating the comment...
>>> Now who knows what's in the mind of the conceptor?
>>> It's like the fresh environment is abandonware...
>>>
>>>
>>> 2014-10-29 19:53 GMT+01:00 Chris Muller <[hidden email]>:
>>>>
>>>> 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?
>>>>
>>>>   a) Defining X should put it in 'bindings' instead of 'declarations'?
>>>>   b) Accessing X should access from 'declarations' instead of 'bindings'?
>>>>   c) Defining X should put it in BOTH  'declarations' and 'bindings'?
>>>>
>>>
>>
>>
>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Urgent: how to define a global?

Chris Muller-4
On Thu, Oct 30, 2014 at 5:28 PM, Levente Uzonyi <[hidden email]> wrote:
> On Thu, 30 Oct 2014, Chris Muller wrote:
>
>> Thanks guys, those both helped.  After defining X I found I could do a
>> "Smalltalk importSelf" to get it copied into the 'bindings'
>> Dictionary.
>
>
> #importSelf is not what you want do, because that'll add the same policy to
> your environment again.

Oh wow, and it even will allow duplicates..(!?)  I didn't even notice
that because I was just interested in the second part of that method.

I was just operating as a Smalltalker; backtracing what was causing my
#X lookup problem, and found it was because it wasn't in 'bindings'.
So I browsed who ever adds anything into 'bindings'?  Only #importSelf
and #showBinding:.  So to get the "side-effect" I wanted, I
inadvertently also added a second BindingPolicy.  I manually removed
the duplicate BindingPolicy, thanks for the heads-up.

I think Squeak's frameworks should be implemented in a way that caters
to its own IDE, so Smalltalker's can figure things out by those normal
tracing activities (senders, references, implementors).  #importSelf
seems like a not-so-good method.

Reply | Threaded
Open this post in threaded view
|

Re: Urgent: how to define a global?

Nicolas Cellier
Yeah, I also already noticed about these nested nested nested policies...
All this is far from obvious and the comments do not help ;)

Still on the same subject there is also this previous analysis in http://source.squeak.org/inbox/Kernel-nice.798.diff which explains how you can have access to the environment of your superclass... I don't know if it is still true, but for me, the fact that I couldn't correct this was not a sign of good health.

2014-10-31 2:10 GMT+01:00 Chris Muller <[hidden email]>:
On Thu, Oct 30, 2014 at 5:28 PM, Levente Uzonyi <[hidden email]> wrote:
> On Thu, 30 Oct 2014, Chris Muller wrote:
>
>> Thanks guys, those both helped.  After defining X I found I could do a
>> "Smalltalk importSelf" to get it copied into the 'bindings'
>> Dictionary.
>
>
> #importSelf is not what you want do, because that'll add the same policy to
> your environment again.

Oh wow, and it even will allow duplicates..(!?)  I didn't even notice
that because I was just interested in the second part of that method.

I was just operating as a Smalltalker; backtracing what was causing my
#X lookup problem, and found it was because it wasn't in 'bindings'.
So I browsed who ever adds anything into 'bindings'?  Only #importSelf
and #showBinding:.  So to get the "side-effect" I wanted, I
inadvertently also added a second BindingPolicy.  I manually removed
the duplicate BindingPolicy, thanks for the heads-up.

I think Squeak's frameworks should be implemented in a way that caters
to its own IDE, so Smalltalker's can figure things out by those normal
tracing activities (senders, references, implementors).  #importSelf
seems like a not-so-good method.




Reply | Threaded
Open this post in threaded view
|

Re: Urgent: how to define a global?

Tobias Pape
Hi,


Is anybody able to summon Colin on this whole issue?
It would be too bad if one of the 4.5 killer features
actually isn't killing but dead…

Best
        -Tobias

On 31.10.2014, at 23:04, Nicolas Cellier <[hidden email]> wrote:

> Yeah, I also already noticed about these nested nested nested policies...
> All this is far from obvious and the comments do not help ;)
>
> Still on the same subject there is also this previous analysis in http://source.squeak.org/inbox/Kernel-nice.798.diff which explains how you can have access to the environment of your superclass... I don't know if it is still true, but for me, the fact that I couldn't correct this was not a sign of good health.
>
> 2014-10-31 2:10 GMT+01:00 Chris Muller <[hidden email]>:
> On Thu, Oct 30, 2014 at 5:28 PM, Levente Uzonyi <[hidden email]> wrote:
> > On Thu, 30 Oct 2014, Chris Muller wrote:
> >
> >> Thanks guys, those both helped.  After defining X I found I could do a
> >> "Smalltalk importSelf" to get it copied into the 'bindings'
> >> Dictionary.
> >
> >
> > #importSelf is not what you want do, because that'll add the same policy to
> > your environment again.
>
> Oh wow, and it even will allow duplicates..(!?)  I didn't even notice
> that because I was just interested in the second part of that method.
>
> I was just operating as a Smalltalker; backtracing what was causing my
> #X lookup problem, and found it was because it wasn't in 'bindings'.
> So I browsed who ever adds anything into 'bindings'?  Only #importSelf
> and #showBinding:.  So to get the "side-effect" I wanted, I
> inadvertently also added a second BindingPolicy.  I manually removed
> the duplicate BindingPolicy, thanks for the heads-up.
>
> I think Squeak's frameworks should be implemented in a way that caters
> to its own IDE, so Smalltalker's can figure things out by those normal
> tracing activities (senders, references, implementors).  #importSelf
> seems like a not-so-good method.



Reply | Threaded
Open this post in threaded view
|

Re: Urgent: how to define a global?

Colin Putney-3
In reply to this post by Chris Muller-4


On Wed, Oct 29, 2014 at 11:53 AM, Chris Muller <[hidden email]> wrote:
 
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?

  a) Defining X should put it in 'bindings' instead of 'declarations'?
  b) Accessing X should access from 'declarations' instead of 'bindings'?
  c) Defining X should put it in BOTH  'declarations' and 'bindings'?

Hi Chris,

It's c), unless you've set up your environment not to do that, which should not the case for "Smalltalk globals". 

In my (admittedly old) trunk image, declaring a global the way you describe works, as does Levante's suggestion of "Smalltalk at: #X put: OrderedCollection new." I guess the urgency of your debugging effort is over, but you could have gotten going again by copying the binding from 'declarations' to 'bindings'. 

Colin

PS. I'm not paying close attention to squeak-dev these days, but I'm not completely off the grid, so feel free to CC me directly if you want to nudge me on a particular issue. 


Reply | Threaded
Open this post in threaded view
|

Re: Urgent: how to define a global?

Colin Putney-3
In reply to this post by Tobias Pape


On Fri, Oct 31, 2014 at 3:13 PM, Tobias Pape <[hidden email]> wrote:

Is anybody able to summon Colin on this whole issue?
It would be too bad if one of the 4.5 killer features
actually isn't killing but dead…

I'm here, it's just that I'm only reading squeak-dev sporadically, so I might not notice things like this for a few days. As I mentioned to Chris, feel free to CC me when bringing up environments-related issues here or send me email off-list if you want. I'm really busy with meat-world things these days, but I'll make time to fix bugs or help people deal with the new paradigm. Environments isn't dead, just resting. :-)

Colin 


Reply | Threaded
Open this post in threaded view
|

Re: Urgent: how to define a global?

Frank Shearar-3
On 1 November 2014 00:25, Colin Putney <[hidden email]> wrote:

>
>
> On Fri, Oct 31, 2014 at 3:13 PM, Tobias Pape <[hidden email]> wrote:
>
>> Is anybody able to summon Colin on this whole issue?
>> It would be too bad if one of the 4.5 killer features
>> actually isn't killing but dead…
>
>
> I'm here, it's just that I'm only reading squeak-dev sporadically, so I
> might not notice things like this for a few days. As I mentioned to Chris,
> feel free to CC me when bringing up environments-related issues here or send
> me email off-list if you want. I'm really busy with meat-world things these
> days, but I'll make time to fix bugs or help people deal with the new
> paradigm. Environments isn't dead, just resting. :-)

The proximity of "meat" and "resting" in those sentences makes me a
bit hungry...

frank

> Colin
>
>
>