[squeak-dev] Re: Halt

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Mon Aug 29 11:43:09 UTC 2011

2011/8/29 Bert Freudenberg <bert at freudenbergs.de>:
> 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
> becomes
>        ^ (foo bar haltIf: [:x | x > 42]) + fum
> - Bert -

Ah yes, (Halt if: foo bar > 42) + fum cannot behave correctly and the
intention of (Halt if:foo bar satisfies: [:x | x > 42]) + fum gets a
bit obscured...
I wonder if really used that often (I didn't even know about such
smart message).


More information about the Squeak-dev mailing list