At 11:06 +0300 on 28/06/1999, Rudy Gireyev wrote:
> This may be slightly more reasonable. :-)
> But ideally one would like to say:
> SELECT * from chargehistory WHERE "new" is TRUE;
>
> No? :-)
If you are into semantics, I don't really think so. You say things like "If
unsure, ask an expert", not "If unsure is true, ask an expert". Or "Make
the y2k correction where applicable", not "Make the y2k correction where
applicable is true".
If your column name is an adjective, the sentence is natural enough.
At 10:24 +0300 on 28/06/1999, Ansley, Michael wrote:
> Definitely. However, if you ever use something like Visual Basic, you learn
> the hard way not to do this, because it doesn't have a native boolean type.
> It tries to hack an integer into a boolean, and hacks the bitwise AND, OR,
> and NOT operators to perform like logical ones. This works great most of
> the time, but to find it when it isn't working is a nightmare.
>
> Of course, in a real environment, where programs work like they should, this
> shouldn't happen.
Of course this only applies to languages which have native booleans. I
sometimes use this rule of thumb in C as well, but only because it has
native boolean operators. In general, it is better to know the language a
bit before you write in it.
Anyway, the rule of thumb is, if you like: "When you find yourself
comparing things to strictly boolean literals (like TRUE, FALSE, T, F, or
whatever the language dictates), don't."
Herouth
--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma