[squeak-dev] The Trunk: Kernel-ul.709.mcz

Tobias Pape Das.Linux at gmx.de
Wed Sep 5 11:10:55 UTC 2012


Am 05.09.2012 um 11:42 schrieb Frank Shearar:

> On 4 September 2012 18:03, Frank Shearar <frank.shearar at gmail.com> wrote:
>> On 4 September 2012 15:25, Levente Uzonyi <leves at elte.hu> wrote:
>>> On Tue, 4 Sep 2012, Frank Shearar wrote:
>>> 
>>> 
>>> 
>>> No, but it would expose the environment dictionary and would make all these
>>> methods pointless.
>> 
>> Surely noone ever uses methods marked private!
> 
> 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
> dictionary.


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 ...)

Best
	-Tobias


More information about the Squeak-dev mailing list