lua-users home
lua-l archive

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


2010/12/15 Pierre-Yves Gérardy <pygy79@gmail.com>:
> Surprisingly, some (most?) functions in the standard lib don't behave as if
> an empty arg list was nil...

Yes, the fact that foo() and foo(nil) are distinct (since foo can
detect the number of arguments it was passed) is a subtlety which
takes a while to get used to.

nil is very definitely a value, which is overloaded with a few special
meanings, such that t[k] = nil is an instruction to remove the key k,
and t[k]==nil means that the key was not present. So as far as tables
are concerned, it is an anti-value.

OTT, when I was a theoretical physicist, I found that working
physicists very rarely discuss philosophical implications, in fact
they tend to regard it as a sign of immaturity. This made tea room
discussions less fun than they could have been, however. I found their
lack of curiosity about the implications of quantum mechanics a bit
disappointing, but I've since made peace with the Copenhagen
interpretation.

steve d.