[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: new "empty" value/type in Lua?
- From: Philippe Lhoste <PhiLho@...>
- Date: Tue, 02 Jul 2013 11:45:13 +0200
On 02/07/2013 02:41, Tim Hill wrote:
omg DON'T get me started on *that* mess (grin).
Even the !FALSE trick doesn't work:
if (x == TRUE)…
if (x) …
Still give different results
This proves again that if you try to use booleans, you better use them as booleans, ie. in
the second style.
In Java too, I groan when I see
if (b == true)
because it is verbose, distracting, redundant.
And I saw many newbies just forgetting the difference between = and ==:
if (b = true)
and wondering why the test doesn't work. In Java, that's the only case where an assignment
in a test is legal. In C, it can be worse...
Now, I agree that
if (!b)
isn't super-readable, alas. That's where the choice of ~ for negation is good, it stands
out more... :-)
--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --