Dynamic variables

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamic variables

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

Reply | Threaded
Open this post in threaded view
|

Re: Dynamic variables

Tobias Pape
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
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic variables

Colin Putney-3
In reply to this post by Frank Shearar
On Fri, Jan 21, 2011 at 6:42 AM, Frank Shearar
<[hidden email]> wrote:

> 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!

Hi Frank,

DynamicBindings was actually written by Stephen Pair as part of the
Comanche web server, though Göran and Samir have been maintaining it
in recent years. You probably want to use the version on SqueakSource
since SqueakMap isn't maintained much anymore. As Tobias notes, you
could also use resumable exceptions to for your purposes.

HTH,

Colin

Reply | Threaded
Open this post in threaded view
|

Re: Dynamic variables

Steinert, Bastian
You may also check out the following project:

http://www.squeaksource.com/ProcessLocalStorage/

<http://www.squeaksource.com/ProcessLocalStorage/>cited from the website:
"This project provides process-specific variables (called TLS - thread-local storage) in other environments. Two kinds of variables are provided: ProcessLocalVariable (similar to TLS), and DynamicVariables (akin LISP's dynamic scope)"

Regards,
Bastian

On Jan 21, 2011, at 7:08 PM, Colin Putney wrote:

On Fri, Jan 21, 2011 at 6:42 AM, Frank Shearar
<[hidden email]<mailto:[hidden email]>> wrote:
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!

Hi Frank,

DynamicBindings was actually written by Stephen Pair as part of the
Comanche web server, though Göran and Samir have been maintaining it
in recent years. You probably want to use the version on SqueakSource
since SqueakMap isn't maintained much anymore. As Tobias notes, you
could also use resumable exceptions to for your purposes.

HTH,

Colin