[Sc-devel] [approve] asBoolean
Julian Rohrhuber
rohrhuber at uni-hamburg.de
Sat Dec 22 19:47:54 PST 2007
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) { ... }
--
.
More information about the Sc-devel
mailing list