Dynamic scoping (was: Proposal: Squeak-E = Squeak x Kernel-E)

Stephen Pair spair at acm.org
Mon Jan 27 19:41:18 UTC 2003


Avi Bryant wrote:

> On Mon, 27 Jan 2003, Stephen Pair wrote:
> 
> > Have you looked at RuntimeEnvironments (on SqueakMap)?  They 
> > accomplish the same effect, but they are cleaner than using 
> > exceptions...
> 
> By whose definition of cleaner? ;)

Well, I consider "Env at: #world" to be more clear about the intent than
"MyWorldEnvironment signal" or similar...don't you?  I think you are
looking at the implementation.

> I find using exceptions preferable for at least two reasons:
> 
>  - the semantics of dynamic scope are defined by the context 
> stack, not by Process.  There is not always a one-one 
> relationship here.  

I agree, but you're speaking about implementation.

> If you use a dynamic scoping mechanism 
> that walks the context stack, you get the correct behavior 
> for free when working with constructs like Continuation. 
> RuntimeEnvironments would require special treatment to work 
> across coroutining or continuation invocation.

Yes, your implementation of Continuation has made that clearly evident
to me.  ;)

I agree that the runtime environment should be inter-woven in the
context stack.  I'm actually working on that change right now.
 
>  - a mechanism based purely on exceptions is likely to be 
> fairly portable, and also likely to make good use of primitives

Agreed.

- Stephen



More information about the Squeak-dev mailing list