[NIT] Pretty pretting #ifFalse:ifTrue:
Tim Rowledge
tim at sumeru.stanford.edu
Mon Nov 19 23:01:07 UTC 2001
Bob Arning <arning at charm.net> is widely believed to have written:
> Tim,
>
> I tried this and it seems to work either way.
>
> before pretty printing --
> b _ (el bar) isNil ifTrue:[nil] ifFalse:[el bar].
>
> and after pretty printing --
> b _ (el bar) isNil ifFalse:[el bar].
>
> both assign a new value to b every time through the loop. If the assignment has been inside the block, one might see a difference, but then the block would not have been dropped by pretty-printing.
Well, dang and gosh. It's true - ifFalse:/ifTrue: return nil if their
block is not evaluated. I've never spotted that before! I always assumed
it would return the boolean value.
It's truly wonderful to still be learning new things about Smalltalk
after all these years. Or maybe it's just senility?
tim
--
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
Those who can't write, write help files.
More information about the Squeak-dev
mailing list
|