[squeak-dev] Dynamic variables

Tobias Pape Das.Linux at gmx.de
Fri Jan 21 17:46:47 UTC 2011


Am 2011-01-21 um 15:42 schrieb Frank Shearar:
> Is there an analogue to Common Lisp's dynamic variables in Squeak?
> 
> It looks like Goran Krampe's DynamicBindings (http://map.squeak.org/package/9f2cdda3-c666-459c-ba5e-55a91b428f40) MIGHT be what I'm looking for, but there's also Samir Saidani's DynamicBindings (http://www.squeaksource.com/DynamicBindings.html, moved to http://www.squeaksource.com/KomHttpServer.html). Are these two packages related?
> 
> (I'm trying to figure out the restart capabilities of Common Lisp's conditions, and thought a good way to do that would be by adding same to Squeak. It looks like one of the requirements is something like dynamic variables, to allow the lookup of a suitable restart.)
> 
> Thanks in advance for any help/advice/etc!
> 
> frank
> 

I think there was something like this in Seaside
(WADynamicVariable, iirc). It is (was) implemented as an Exception
whose default value was set to the value you wanted to be used
in the following control flow.
IIRC, the protocol was

Subclass WADynamicVariable, e.g., MyDynamicVar.

then:

MyDynamicVar use: aValue during: [ 
	"this is a simple block in whose control flow you can use" 
	MyDynamicVar value.
	" to access aValue"].

HTH
So Long,
	-Tobias


More information about the Squeak-dev mailing list