Yes ;-) in fact Andrés Valloud wrote a book "Fundamentals of Smalltalk 
Programming Technique" which he discusses the theme of Booleans in Chapter 3 
and specifically the optimization you discovered in 3.2.1.

--
Cesar Rabak


Em 05/03/2010 04:22, Igor Stasenko < [email protected] > escreveu:
Hello,
I just realized, that one can completely avoid using ifTrue/ifFalse
branches, but use #or: and #and: instead.

a > b ifTrue: [ ... ]
could be written as:
a > b and: [ ... ]

a > b ifFalse: [ ... ]
could be written as:
a > b or: [ ... ]

and
a > b ifTrue: [ self foo ] ifFalse: [ self bar ]
could be written as:

a > b and: [ self foo]; or:[ self bar ]

:)

-- 
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to