[Pharo-project] Compiler pedantic about ifNotNil: argument

Stéphane Ducasse stephane.ducasse at inria.fr
Mon Oct 11 08:18:17 EDT 2010

>> 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.


More information about the Pharo-dev mailing list