Process local variable and debugging

Anthony Hannan ajh18 at cornell.edu
Wed Feb 13 16:47:01 UTC 2002


Stephen Pair <spair at advantive.com> wrote:
> I actually implemented something like this in the Comanche Process
> extension (the one that adds 'context' to Process).  I allowed not only
> for this to be a dictionary of named process globals, I also allowed you
> to stack several dictionaries up to override a given value at any
> position in the stack (allowing it to be restored).  As it turns out,
> this was overkill and mostly unnecessary for a couple of reasons.
> First, I have yet to find a compelling use of it, and second, you can
> just set the value of a process global to something, make a call, then
> restore the old value (protecting this with ensure).  For example:
> 
> 	oldUser := thisContext process user.
> 	thisContext process user: someNewUser.
> 	[self doSomething] ensure: [thisContext process user: oldUser].

Stacked dictionaries are like nested runtime environments, which I like.
A user can set up his/her environment that inherits from zero or more 
other environments and then run one or more processes in that 
environment.  Each process running in that environment would look up
its "dynamic" globals with a command like "thisContext envAt: #User" 
(envAt: varName would call "self process runtimeEnvironment at: 
varName").  A RuntimeEnvironment (like Environment in Squeak) would 
look in its local dictionary before looking in its parent(s).  Ambiguities 
in parents would raise an error.  RuntimeEnvironment globals are akin 
to "static" globals in nested Modules.

Cheers,
Anthony



More information about the Squeak-dev mailing list