lua-users home
lua-l archive

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


Hi,

I've been working a bit with SQL in Lua, which lead me to exercise a bit of curiousity at the REPL:

> = true and nil
nil

So far so good!

> = nil and true
nil

Excellent, Abelian, carry on

> = false and nil
false

.. Oh. That's not three-valued logic, then. Well at least

> = nil and false
nil

That's... not Abelian either.

I would like to propose that a future Lua have `false and nil` yield nil, and the same for `nil and false`.  This would give an identical semantics to the three-valued SQL null[0], and make the trio of values Abelian with respect to one another.

[0]: https://en.wikipedia.org/wiki/Null_(SQL)#Comparisons_with_NULL_and_the_three-valued_logic_(3VL)

Sincerely,
-Sam Putman.
--
Special Circumstances