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

Marcel Taeumel marcel.taeumel at student.hpi.uni-potsdam.de
Sat Jan 31 13:23:00 UTC 2015


This would work:

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 ifFalse: [p environmentAt: self put: oldValue] ].



--
View this message in context: http://forum.world.st/Oblivous-caching-DynamicVariable-default-tp4802924p4802926.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.


More information about the Squeak-dev mailing list