argument of ifNotNil: must be a 0-argument block

Mathieu mathk.sue at gmail.com
Sat Sep 2 00:10:42 UTC 2006


Andreas Raab a écrit :
> 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.

I think this is more beacause the right behavior is this. As Ken Causey said (old) compiler do it wrong.

Math




More information about the Squeak-dev mailing list