Re: In praise of 'nil' (Was: Proposal for table length operator
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: In praise of 'nil' (Was: Proposal for table length operator
- From: David Kastrup <dak@...>
- Date: 2010年12月15日 10:05:19 +0100
steve donovan <steve.j.donovan@gmail.com> writes:
> 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.
It is not an "anti-value" but the default value.
--
David Kastrup