Created
September 12, 2010 14:46
-
-
Save vito/576158 to your computer and use it in GitHub Desktop.
parameters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Parameter = Object clone | |
| Parameter new: v := Parameter clone do: { | |
| value: (self) = v | |
| value: _ = v | |
| } | |
| (p: Parameter) _? := p value: self | |
| (p: Parameter) set: v := | |
| (p) value: (self) = v | |
| with: (p: Parameter) as: new do: (action: Block) := { | |
| old = p _? | |
| p set: new | |
| p ensuring: @(set: old) do: action | |
| } call |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example:
And it's thread-safe!