"Randal L. Schwartz" wrote:
"Doug" == Doug Way dway@riskmetrics.com writes:
Doug> Insert this instead into the place where you were putting your halt:
Doug> self doOnlyOnce: [self halt].
Doug> See ProtoObject>>doOnlyOnce: for more details. (By the way, it Doug> seems like this method doesn't really need to be all the way up Doug> in ProtoObject, since it's just a utility method which doesn't Doug> refer to self. Maybe Object would suffice?)
How would you debug a non-Object object then? you couldn't say "self doOnlyOnce: ...".
It needs to be at the top of the foodchain to be useful for everything.
Well, you could do something like "1 doOnlyOnce: [1 halt]" to set a one-time halt in a non-Object.
#halt currently isn't in ProtoObject, so you won't be able to do a "self halt" there anyway. It kind of seems like the #doOnlyOnce:/#rearmOneShot code is related to #halt/etc and maybe belongs with that stuff in Object. Although I suppose one might have a reason to use doOnlyOnce: without doing a halt.
ProtoObject is pretty lean & mean with only 19 methods, so you don't want to add any more than is absolutely necessary there...
- Doug Way dway@riskmetrics.com