Dynamic scoping (was: Proposal: Squeak-E = Squeak x Kernel-E)
Anthony Hannan
ajh18 at cornell.edu
Mon Jan 27 18:09:51 UTC 2003
"Stephen Pair" <spair at acm.org> wrote:
> Anthony wrote:
> > So I think both static scope (pools) and dynamic scope
> > (contexts) are appropriate. The significance is dynamic
> > scope is not an extra concept like islands. I believe this
> > is more in line with the objects-as-capabilities concept.
>
> Have you looked at RuntimeEnvironments (on SqueakMap)? They accomplish
> the same effect, but they are cleaner than using exceptions...they also
> work when a process is forked. To do what you describe would look like:
>
> ----
> Env clamp: [
> Env at: #world put: aWorld.
> self doSomethingThatRequiresAWorld.
> ].
> ----
> SomeClass>>doSomethingThatRequiresAWorld
>
> (Env at: #world) doSomething.
> ----
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. 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. (It would not be
hard to fork a process with the initial context holding context handlers
from its parent process).
Cheers,
Anthony
More information about the Squeak-dev
mailing list
|