Context Sensitive Bindings (was Re: Exception Hierarchies)
Stephan B. Wessels
stephan.wessels at sdrc.com
Tue Aug 17 17:28:57 UTC 1999
Allen,
Wouldn't it be better to not name the class in it's own class methods? I realize you
were citing examples. Just want to make sure there's isn't some subtlety going on
here that would keep me from subclassing.
Allen Wirfs-Brock wrote:
> "Subclassing Notification is an easy way to make an exception resumable"
> Notification subclass: #Fluid
> instanceVariableNames: "bindingName"
> ...
>
> "class methods"
> named: bindingName value: boundValue do: aBlock
> "Evaluate a block in the context of a fluid binding"
> [aBlock] on: Fluid
> do: [:ex|
> ex bindingName = bindingName ifFalse: [ex pass].
> ex resume: boundValue]
>
> named: bindingName
> "Get the value of a dynamically bound variable"
> ^(Fluid new named: bindingName) signal
as:
"class methods"
named: bindingName value: boundValue do: aBlock
"Evaluate <aBlock> in the context of our own binding."
[aBlock] on: self do: [:ex |
ex bindingName = bindingName ifFalse: [ex pass].
ex resume: boundValue]
named: bindingName
"Get the value of a dynamically bound variable."
^(self new named: bindingName) signal
- Steve
--
Talk Small and Carry a Big Class Library
More information about the Squeak-dev
mailing list
|