Closed lhorie closed 8 years ago
Agreed; ()
→ null
would be neat. It should mean something, and null
is least surprising.
The for
macro could just do its own detection of when its first 3 arguments are empty lists.
IIRC, it is in common lisp.
In eslisp, you can use
()
in the(for () () ())
special form to create an infinite loopfor (;;) {}
But if you use
()
in an expression, it throws a compilation error, e.g.(+ 1 ()) -> BinaryExpression right member must be an expression node
.Typically
()
evaluates tonil
, so I'd expect the output to be1 + null
with no compiler error.It'd still need to keep current behavior in for-loops, since
for (;;) {}
is a different thing fromfor (null; null; null) {}
.Alternatively,
()
could always meannull
, and there would be another way of expressing empty expressions in for loops.