[squeak-dev] The Trunk: Kernel-ul.709.mcz
Das.Linux at gmx.de
Wed Sep 5 11:51:00 UTC 2012
Am 05.09.2012 um 13:27 schrieb Frank Shearar:
> On 5 September 2012 12:10, Tobias Pape <Das.Linux at gmx.de> wrote:
>> Am 05.09.2012 um 11:42 schrieb Frank Shearar:
>>> On 4 September 2012 18:03, Frank Shearar <frank.shearar at gmail.com> wrote:
>>> OK, so how about pushing the env ifNil:  into ensure? Do you think
>>> this would look a bit less weird?:
>>> Process >> #environmentAt: key ifAbsentPut: aBlock
>>> self ensureEnvironment.
>>> ^env at: key ifAbsentPut: aBlock
>>> I dislike the necessity to remember to "self ensureEnvironment" before
>>> any access of env, but I take your point regarding exposing the
>> What about
>> Process >> #pvtEnvironment
>> ^ env ifNil: [env := Dictionary new]
>> Process >> #environmentAt: key ifAbsentPut: aBlock
>> ^ self pvtEnvironment at: key ifAbsentPut: aBlock
>> (naming subject to bikeshedding,
>> eg, name it pvtEnvironment, ensureEnvironment, ensuredEnvironment,
>> theEnvironment ...)
> While #pvtEnvironment is more forceful than categorising #environment
> as 'private' in indicating "don't use this", I expect Levente to still
> say "yes but that still exposes the dictionary!"
so does aProcess instVarNamed: 'env' (SCRN)
The point is that the
relies too much on side-effects, imho.
Two things here:
1) what is the harm of exposing the dictionary?
If you use it, you are guilty nonetheless
2) What speaks against initalizing the env in an #initialize?
That would remove these checks alltogether :)
More information about the Squeak-dev