[Pharo-project] Compiler pedantic about ifNotNil: argument

Henrik Johansen henrik.s.johansen at veloxit.no
Mon Oct 11 05:21:12 EDT 2010


On Oct 10, 2010, at 3:13 08PM, Stéphane Ducasse wrote:

> personnally I do not like this form
> What does it do?
> 
>>   process ifNotNil: #terminate.
> 
> 
> for me it means passes the symbol #terminate as argument to the method ifNotNil:
> If it has a more magical behavior then I do not know it.
> 
> Stef

It's exactly the same as using collection do: #something.

FWIW, in 1.2 we already included the compiler changes Levente suggested to me to remove this restriction, so

nil ifNotNil: #squared -> nil
4 ifNotNil: #squared -> 16.

I.e. it already does what Nicolas suggested. (As per the Symbol>>#cull: thread)

Cheers,
Henry

> 
> 
>> The compiler uselessly insist on #ifNotNil: argument being a zero/one arg block.
>> Thus we cannot write this xtream sentence
>> 
>>   process ifNotNil: #terminate.
>> 
>> When the argument is not a block, Compiler should avoid inlining and
>> just send a normal message.
>> 
>> cheers
>> 
>> Nicolas
>> 
>> _______________________________________________
>> Pharo-project mailing list
>> Pharo-project at lists.gforge.inria.fr
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> 
> 
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project





More information about the Pharo-dev mailing list