Hi Doug,
[self halt] doOnlyOnce.
This is neat, I like it. But is it sementically the same as:
self doOnlyOnce: [self halt].
If you have a change set, I volunteer to test it ;-)
Cheers,
PhiHo
----- Original Message ----- From: "Doug Way" dway@riskmetrics.com To: squeak-dev@lists.squeakfoundation.org Sent: Thursday, October 04, 2001 8:06 PM Subject: #doOnlyOnce (was Re: [BUG] '3 + 4' crashes Squeak ...)
"Randal L. Schwartz" wrote:
In that case, what you really want is a DoOnlyOnce class subclassed from Object, as a singleton, with the protocol:
DoOnlyOnce arm "in a do-it" ... DoOnlyOnce once: [self halt] "in a method"
Looking at this (and our earlier exchanges), and noticing that we're
trying to find a place to hang a method which is always passed a block... now I'm thinking that the best way to handle it would be to add an instance method to BlockContext, so that the usage becomes simply:
[self halt] doOnlyOnce.
(Or, in keeping with other BlockContext methods, maybe #valueOnlyOnce.
But somehow #doOnlyOnce seems better.)
The #rearmOneShot method would become a class method for BlockContext.
... I know. "Changesets welcome" :)
Yes. Not that it would be hard to make this changeset, but I'd rather
wait until the violent disagreement subsides first... :)
- Doug Way dway@riskmetrics.com