argument of ifNotNil: must be a 0-argument block

Ron Teitelbaum Ron at USMedRec.com
Sat Sep 2 00:07:40 UTC 2006


I spent a while tracking this down trying to fix it the other day.  It was a
very interesting problem.  It passes through a huge amount of code before
deciding what to do.  transformifNil -> transformifNilIfNotNil: ->
transformIfTrueIfFalse or something like that.  At the end I said ahh it's
not worth it.  It's a bummer too because I like the ifNotNil: with an
argument.

Ron

> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org [mailto:squeak-dev-
> bounces at lists.squeakfoundation.org] On Behalf Of Andreas Raab
> Sent: Friday, September 01, 2006 7:40 PM
> To: The general-purpose Squeak developers list
> Subject: Re: argument of ifNotNil: must be a 0-argument block
> 
> 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