[squeak-dev] Re: Oblivous caching: DynamicVariable >> #default

Levente Uzonyi leves at elte.hu
Sat Jan 31 16:07:37 UTC 2015


This change looks right to me.

Levente

On Sat, 31 Jan 2015, Marcel Taeumel wrote:

> Actually, *this* seems to work now:
>
> value: anObject during: aBlock
>
> 	| p oldValue defaultUsed |
> 	p := Processor activeProcess.
> 	defaultUsed := false.
> 	oldValue := p environmentAt: self ifAbsent: [defaultUsed := true. nil].
> 	^[
> 		p environmentAt: self put: anObject.
> 		aBlock value ]
> 			ensure: [ defaultUsed
> 					ifTrue: [p environmentRemoveKey: self]
> 					ifFalse: [p environmentAt: self put: oldValue] ].
>
>
>
> --
> View this message in context: http://forum.world.st/Oblivous-caching-DynamicVariable-default-tp4802924p4802936.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>
>


More information about the Squeak-dev mailing list