Bug? Inconsistency?: false ifTrue: [] ==> nil

garau at ar.ibm.com garau at ar.ibm.com
Mon Jan 24 13:31:30 UTC 2000



I also found that
     something isNil ifTrue: [whatever]
generates more efficient code that
     something ifNil: [whatever]

In the first case the compiler can inline the ifTrue block. In the second
case is just a regular message send. This also might be counter-intuitive.

Regards,

Francisco (Pancho) Garau
Ph: (5411) 4319-6213. Fax: (5411) 4319-6422
garau at ar.ibm.com (work) - - - fgarau at bigfoot.com (home)


squeak at cs.uiuc.edu on 24/01/2000 05:17:16

Please respond to squeak at cs.uiuc.edu

To:   Squeak list <squeak at cs.uiuc.edu>
cc:    (bcc: Francisco Garau/Argentina/IBM)
Subject:  Bug? Inconsistency?:   false ifTrue: [] ==> nil




Here's one from the nitpick department:

When you do eg.

1.    nil ifNotNil: [whatever] you get nil in return, and
2.    #whatever ifNil: [#something] ==> #whatever

which is very convenient and nice -- but:

3.    false ifTrue: [#hello]  ==> nil (not false as I'd expect)

and the same goes for:

4.    true ifFalse: [#hello]  ==> nil


This would seem like a bug to me, or at least an inconsistency, because of
case #2. But perhaps this is how it should be?

Again, not a big deal at all I suppose.

Henrik
< = > .









More information about the Squeak-dev mailing list