On Tue, Apr 4, 2017 at 3:47 PM, Eliot Miranda eliot.miranda@gmail.com wrote:
Hi Levente,
On Apr 3, 2017, at 11:14 AM, Levente Uzonyi leves@caesar.elte.hu
wrote:
The correct solution is:
Array streamContents: [ :stream | Smalltalk globals associationsDo: [ :binding | binding class == Global ifTrue: [ stream nextPut: binding ] ] ].
Or shorter
Smalltalk globals declarations select: #canAssign
maybe? Unlike class bindings, global vars are writable.
Why not
Array streamContents: [ :stream | Smalltalk globals associationsDo: [ :binding | (binding class == Global and: [ binding value isBehavior and: [ binding key == binding value name ] ]) ifTrue: [ stream nextPut: binding ] ] ].
Because we want to know the global *variables*, that is everything *but* the class bindings. So we look for instances of Global, not ClassBinding, no matter the value.
The role of declarations and bindings is still not clear in Environments, therefore, as I wrote it before, unrelated to tool support, I still consider Environments to be incomplete.
I thought 'declarations' are the things owned by this environment (excluding imports), whereas 'bindings' are the things visible in this environment (including imports).
- Bert -