On Thu, Jul 16, 2015 at 4:00 PM, Tim Caswell <tim@creationix.com> wrote:
This is one of those areas where languages without infix notation, but
variable-length arguments (like lisp) smile. You can just do (< x y z)
and
it will do what you expect or (< (<x y) z) to simulate the lua
behaviour.
But then you have to give up infix notation and/or have crazy
conventions
like {x < y < z} means to transform to (< x y z) if curly braces are
used
and every odd symbol is the same.
It's also possible to do it at the grammar level, defining the
comparison operators as being optionally ternary.
If you allow that, you probably also want to allow x < y <= z and the like.
I don't think the complexity is really worth it, but if a language is
going to support such things it could go further and do something like:
if y in ]x,z] then
which would also work with things like:
if y in {3, 5, 7, 9} then
I don't think Lua is or should be that language though :)