[squeak-dev] Re: Halt
bert at freudenbergs.de
Mon Aug 29 11:28:36 UTC 2011
On 29.08.2011, at 18:14, DeNigris Sean wrote:
> What is the purpose of #haltIf: aBlock?
> Right now, you can pass any of the following to Object>>haltIf:
> - aBlock taking an optional argument which is automatically set to the receiver of #halt
> - aSelector which looks up the call chain and halts if present
> - aBoolean
> So, whatever the condition is, it seems like you should be able to evaluate it in the calling context. When would you ever need to use a block? Can we eliminate the block behavior? Or, who has a great war story about blocks saving them from imminent doom...
It's useful for testing an intermediate result, without having to declare another temp. E.g.:
^ foo bar + fum
^ (foo bar haltIf: [:x | x > 42]) + fum
- Bert -
More information about the Squeak-dev