Dynamic scoping (was: Proposal: Squeak-E = Squeak x Kernel-E)
Stephen Pair
spair at acm.org
Mon Jan 27 19:41:18 UTC 2003
Anthony wrote:
> Sorry, Stephen, I forgot to mention your work. Our two
> implementations are basically equivalent. I think mine is a
> little faster since it reuses the context sender chain
> (hierarchy) instead of creating a new parallel environment
> hierarchy.
Is your stuff available? Will it work on a stock VM?
You mentioned using resumable exceptions directly. I consider that to
be a poor way to getting a runtime environment (mainly because you'd
need a separate class for getting each variable). But, I guess you were
speaking of how to do it in the absence of a dynamic context mechanism.
Actually, I've been considering enhancing RuntimeEnvironments use the
context stack as well (it is redundant to manage the parallel
hierarchy). I didn't do that initially because of some legacy code that
I wasn't sure would map well to a context stack based approach...as it
turns out, it does. But, the usage above would remain the same.
> This allows me to re-implement Exceptions to use
> my general context handlers/environments, without loss of
> efficiency. Your point about environments being inherited by
> forked processes is a nice option, but I wouldn't leave out
> exception handlers from being inherited also. I believe
> exception handlers and dynamic variables should be treated
> the same, not differently.
Agreed. The exception handlers should be maintained as runtime
environment values. And runtime environment lookup should be using the
VMs handler context lookup machinery.
- Stephen
More information about the Squeak-dev
mailing list
|