Dynamic scoping (was: Proposal: Squeak-E = Squeak x Kernel-E)
spair at acm.org
Mon Jan 27 20:04:13 UTC 2003
Avi Bryant wrote:
> Well, yeah. :) I thought that's what you meant. Obviously
> there's no reason you can't have the same interface to both
> implementation approaches. I currently use an exception
> based dynamic scope that looks like
> DynamicContext bind: #foo to: 42 during:
> self assert: #foo dynamicValue = 42
> self assert: #foo dynamicValue isNil.
Actually, I rather like the #dynamicValue pattern. Why not this then:
DynamicContext clamp: [
#foo dynamicValue: 42.
self assert: #foo dynamicValue = 42
self assert: #foo dynamicValue isNil
With the above, if you need to set several values, you don't need to
enclose your code in several blocks.
More information about the Squeak-dev