[squeak-dev] Compiler pedantic about ifNotNil: argument

Levente Uzonyi leves at elte.hu
Sun Oct 10 23:17:41 UTC 2010


On Mon, 11 Oct 2010, Igor Stasenko wrote:

> On 10 October 2010 21:36, Levente Uzonyi <leves at elte.hu> wrote:
>> On Sun, 10 Oct 2010, Igor Stasenko wrote:
>>
>>> Okay,
>>> lets assume, we using #cull: for ifNotNil: argument.
>>>
>>> Then how about ifNil:ifNotNil ?
>>>
>>> What you expect from given example:
>>>
>>> self perform: (object ifNil: #foo ifNotNil: #bar)
>>
>> If object is nil, then the value of [self perform: #foo], else [self
>> perform: (object perform: #bar)].
>>
> oh really? it is because you defined so.

It's not just me. It's like this in VW and Pharo (1.2).

> but if you don't know what inside, what will be a least surprising and
> most expected behavior?

Did you mean: What happens if I don't know what the method will do?
If I know that a method expects a monadic block, but I'm not sure if it 
will accept a symbol (because it sends it may send a message other than 
#value: or #cull:) and I don't want to check it out, then I will use 
a block and that will work sure.


Levente

>
>
>>
>> Levente
>>
>>>
>>> ?
>>>
>>>
>>>
>>> --
>>> Best regards,
>>> Igor Stasenko AKA sig.
>>>
>>>
>>
>>
>
>
>
> -- 
> Best regards,
> Igor Stasenko AKA sig.
>
>



More information about the Squeak-dev mailing list