[Pharo-project] Compiler pedantic about ifNotNil: argument

Igor Stasenko siguctua at gmail.com
Mon Oct 11 08:23:24 EDT 2010


On 11 October 2010 15:18, Stéphane Ducasse <stephane.ducasse at inria.fr> wrote:
>>>
>>>
>>> Now to me this looks like a hack and again it works because now Symbol are valuable objects.
>>> Too many hacks will only make the system more hackish.
>>> And especially the
>>>        iftrue: 'foo' ifFalse: 'zork'
>>>
>>
>> This is not a hack, because if you refer to implementation:
>>
>> True>>ifTrue: trueAlternativeBlock ifFalse: falseAlternativeBlock
>>       ^trueAlternativeBlock value
>>
>> False>>ifTrue: trueAlternativeBlock ifFalse: falseAlternativeBlock
>>       ^falseAlternativeBlock value
>>
>> so, it answers either 'foo' value , or 'zork' value.
>> And #value could be sent to any object in system:
>>
>> Object>>value
>>       ^self
>>
>> What actually shown here is a use of duck typing, because any object,
>> which implemets #value, could be safely passed
>> as argument to #ifTrue:ifFalse: message.
>> It is well consistent with language design.
>
> I know well that. and it sucks from a language semantics point of view.
> I agree with the mail of lukas.
>

Okay, your obscurity barrier is higher than mine,
and mine is higher than VW's, Nicolas and Levente's one :)

> Stef
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



-- 
Best regards,
Igor Stasenko AKA sig.




More information about the Pharo-dev mailing list