[NIT] Pretty pretting #ifFalse:ifTrue:

Andrew C. Greenberg werdna at mucow.com
Mon Nov 19 12:53:07 UTC 2001


Aren't these expressions semantically identical?  Doesn't

	bool ifTrue: block

evaluate to nil if bool is false?

On Monday, November 19, 2001, at 01:33  AM, Tim Rowledge wrote:

> 	a _ bool
> 		ifTrue:[self fribble]
> 		ifFalse:[nil]
> it will usually get turned into
> 	a _ bool ifTrue:[self fribble]
> with the other clause getting dropped.
>
> This is acceptable, indeed an optimisation in many cases, but not for
> example in a loop where you need 'a' to _reset_ to nil part way through
> an enumeration.





More information about the Squeak-dev mailing list