[squeak-dev] The Inbox: Environments-cmm.57.mcz
Chris Muller
asqueaker at gmail.com
Tue Mar 24 02:08:47 UTC 2015
To define a global variable in code, while taking care not to
over-write it if it already is defined, I wrote:
Smalltalk at: #MyGlobal ifAbsentPut: [myValue].
But this only put it in the Smalltalk environments 'declarations', not
its 'bindings', which renders MyGlobal inaccessible from any code.
I don't really like this nesting of at:ifAbsentPut: into 'bindings',
but it does solve the bug for the basic case. Is it the right way to
fix it?
On Mon, Mar 23, 2015 at 1:58 PM, <commits at source.squeak.org> wrote:
> Chris Muller uploaded a new version of Environments to project The Inbox:
> http://source.squeak.org/inbox/Environments-cmm.57.mcz
>
> ==================== Summary ====================
>
> Name: Environments-cmm.57
> Author: cmm
> Time: 23 March 2015, 1:58:37.126 pm
> UUID: 6e10d99c-b424-4f94-9152-18ccd72ca623
> Ancestors: Environments-topa.56
>
> Fix access to globals which were defined by: Smalltalk at: #MyGlobal ifAbsentPut: [myValue].
>
> =============== Diff against Environments-topa.56 ===============
>
> Item was changed:
> ----- Method: Environment>>at:ifAbsentPut: (in category 'emulating') -----
> + at: aSymbol ifAbsentPut: aBlock
> - at: aSymbol ifAbsentPut: aBlock
> ^ declarations
> at: aSymbol
> + ifAbsentPut:
> + [ bindings
> + at: aSymbol
> + ifAbsentPut: aBlock ]!
> - ifAbsentPut: aBlock!
>
>
More information about the Squeak-dev
mailing list
|