[squeak-dev] ifTrue: vs. ifFalse:

Louis LaBrunda Lou at Keystone-Software.com
Tue Oct 18 13:20:34 UTC 2011

Hi Guys,

>On 18.10.2011, at 05:11, Chris Muller wrote:
>> (From vm-dev list)
>>> But I much prefer foo ~~ bar ifTrue: than foo == bar ifFalse:.
>> Hi Eliot.  May I ask why you prefer the former over the latter?
>> I'm interested because I'm working on an application where the folks
>> involved prefer something similar, to where they write (expr) not
>> ifTrue: [ ] rather than (expr) ifFalse: [ ].
>> I know you wouldn't do that but your statement definitely piqued my
>> surprise and curiosity.
>Maybe this is a clue: very few other programming languages have an "else"-case without a preceding "if true". So maybe for people versed in multiple languages the ifFalse: feels wrong?
>I personally like "expr ifFalse:" better than "expr not ifTrue:". And I read "~~" as "not identical" which also has a mental "not" in it, so I prefer "== ifFalse" :)
>- Bert -

Allow me to throw out an outside the box (programming box) thought.  If one
is able to mentally read "x ~= y ifTrue:..." or "x == y ifFalse:..." all in
one look, I don't think it matters much as they know what the sentence says
instantly.  It then becomes a matter of what they are use to.

For those of us who read those sentences in two parts: "x ~= y" and
"ifTrue:...", the "not" being included in the comparison is preferred as it
tells us up front what the comparison is about.  Then the second part tells
us what is being done about it.  I hope helps and makes some sense.

Louis LaBrunda
Keystone Software Corp.
SkypeMe callto://PhotonDemon
mailto:Lou at Keystone-Software.com http://www.Keystone-Software.com

More information about the Squeak-dev mailing list