[NIT] Pretty pretting #ifFalse:ifTrue:
Bob Arning
arning at charm.net
Mon Nov 19 17:53:07 UTC 2001
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.
Cheers,
Bob
On Mon, 19 Nov 2001 08:36:10 -0800 Tim Rowledge <tim at sumeru.stanford.edu> wrote:
>|temp a b|
>inputCollection do:[el|
> temp _ Array new:2.
> a _ el foo.
> b _ (el bar) isNil ifTrue:[nil] ifFalse:[el bar].
> temp at: 1 put: a.
> temp at: 2 put: b.
> outputCollection add: temp]
>
>.... or similar. I know it's a bit ugly but there y'go.
>
>Pretty printing will remove the branch that sets b to nil and since b is
>a method temp that will very possibly have been set to something else in
>a previous loop around.... whoops.
More information about the Squeak-dev
mailing list
|