[Sc-devel] [approve] asBoolean
Scott Wilson
i at scottwilson.ca
Wed Dec 26 21:40:40 PST 2007
The only thing that makes me wonder about this is the existence of
Boolean:binaryValue. This makes me think that it would be intuitive
if 0.asBoolean == false. But another solution would be a separate
booleanValue method.
Don't know what's best...
S.
On 22 Dec 2007, at 18:47, Julian Rohrhuber wrote:
> So many times I've come across the choice to either use a true/
> false pair (i.e. I have to check if nil separately) or use the
> formula if(x != true) ... (i.e. have no true inversion: (x ==
> false) means something else than (x != true).not.
>
> my suggestion: asBoolean
>
> Object:asBoolean { ^true } // or false?
> Nil:asBoolean { ^false }
> Boolean:asBoolean { ^this }
>
>
> then we write:
>
> if(x.asBoolean) { ... }
>
>
> --
>
>
>
>
>
> .
> _______________________________________________
> Sc-devel mailing list
> Sc-devel at create.ucsb.edu
> http://www.create.ucsb.edu/mailman/listinfo/sc-devel
More information about the Sc-devel
mailing list