Method Scoping and Runtime Envinronments
spair at acm.org
Fri Feb 7 21:52:17 UTC 2003
Derek Brans wrote:
> It would be so nice to call a function in a piece of code and
> instead of
> the call travelling up the class hierarchy in search of an
> it could also travel through some other scoping hierarchy similar to
> that of Runtime Environments.
You can use blocks to accomplish this result. The code might look like:
Env at: #someName put: [ self doSomething ]
Then, later you could access and evaluate the block with:
(Env at: #someName) value
But, I'm curious why you'd want to do this rather than just invoke a
method of an object in your dynamic scope.
> It would be even cooler if you could just call
> and the system would search self first and then Env for an
This idea touches on layers and perspectives.
As a side note, I've reworked RuntimeEnvironments to incorporate the
ideas discussed in the thread on dynamic scoping. The new version is
not published to SqueakMap yet however; I'm using it in some work I'm
currently doing and will wait until it's had a chance to age a bit.
More information about the Squeak-dev