lua-users home
lua-l archive

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


RLake@oxfam.org.uk writes:

>Memoising functions of more than one argument is a lot 
>trickier, but that wasn't your question.

It wasn't a question.  It was an example.  I know that there are ways
to work around the problems that I was attempting to demonstrate, but
they are still work-arounds.

>Define the global false={} and test for its existence.

A "false" value that can't be used in boolean expressions is hardly a
solution.

I posted three examples where there is a need for a distinction between
"doesn't exist" and "false".  There are many others.  Yes, in each
particular case there's a way of working around it.  But in general
you'll need to come up with a new method every time you hit the
problem.  They're not intuitive.  They hide what the code is really
doing.

If there wasn't the need to keep compatibility with existing code, I
would argue that nil should not behave as "false" in expressions.  It
expresses an entirely different concept.  I find "value == nil" everywhere
I need to test for existence much less confusing than any of the other
options.  But I'm not a C programmer.  NULL == 0 == false only makes
sense if you have a C background.
-Virus scanned and cleared ok