lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Dolan, Ryanne Thomas (UMR-Student) wrote:
Exactly.  The only problem with nil/false is that people use these
values incorrectly.  nil is by no means synonomous with false, so it
makes sense that nil ~= false.  Being false and not defined are two
very different states.

And the proposal that all types should have true/false values seems
strange to me, as anything with true/false evaluations is by
definition a boolean, which Lua of course already has.  Would it make
sense at all if "" == 0?

That's why PHP introduced (in PHP 4.0) the equivalence operators:
if ("" == 0) // TRUE...
if ("" === 0) // FALSE, this operator means "if equal and of same type"

So long as you take the convention that nil means something like
"undefined" then everything makes sense the way it is.

I agree.

Philippe Lhoste
--  (near) Paris -- France
--  --  --  --  --  --  --  --  --  --  --  --  --  --