argument of ifNotNil: must be a 0-argument block

Andreas Raab andreas.raab at gmx.de
Fri Sep 1 23:40:01 UTC 2006


Zulq Alam wrote:
> Why does "Object new ifNotNil: [:object | ]" result in the syntax error 
> "argument of ifNotNil: must be a 0-argument block" when the code appears 
> to be fine with this?
> 
> 
> ProtoObject>>ifNotNil: ifNotNilBlock
>     "Evaluate the block, unless I'm == nil (q.v.)"
> 
>     ^ ifNotNilBlock valueWithPossibleArgs: {self}

Probably because whoever wrote this was blessfully unaware that this 
message is never sent but inlined by the compiler. Admitted, the comment 
should have said as much but the change was obviously never tested. And 
that done in *Proto*Object...

Cheers,
   - Andreas



More information about the Squeak-dev mailing list