This is really beautiful :). Doru On Wed, Sep 16, 2015 at 10:52 AM, Marcus Denker <marcus.denker@inria.fr> wrote:
Hi,
This is just a one-liner to add to the framework, but that makes it even more fun: One-Shot links.
A link now can have the #optionOneShot, which means that it will de-install itself when activated for the first time:
link := MetaLink new metaObject: self; options: #(optionOneShot); selector: #tagExec.
The full test looks like this:
testLinkOneShot | sendNode link | sendNode := (ReflectivityExamples>>#exampleMethod) sendNodes first. link := MetaLink new metaObject: self; options: #(optionOneShot); selector: #tagExec. sendNode link: link. self assert: sendNode hasMetalink. self assert: tag isNil. self assert: (ReflectivityExamples new exampleMethod = 5). self assert: (tag = #yes). self deny: sendNode hasMetalink. tag := nil. self assert: (ReflectivityExamples new exampleMethod = 5). self assert: tag isNil.
https://pharo.fogbugz.com/f/cases/16581/one-shot-links
Marcus
-- www.tudorgirba.com "Every thing has its own flow"