> The idea of a flat ban on #ifTrue:ifFalse: is ridiculous.
> Number>>abs
>    ^self negative ifTrue: [self negated] ifFalse: [self]
> 
> Is there any better way to do this?  Not really, you can
> only move the #ifTrue:ifFalse: somewhere else.

But still it’s always a good thought experiment to think about how to do it 
without the if, as many more interesting objects and approaches can come out of 
it.

From above - it might be interesting if positive numbers were different from 
negative ones ... I’m not saying you would do it (there are often trade offs) 
but it’s too easy to stick in an if and miss out on a richer domain.

Tim

Reply via email to