lua-users home
lua-l archive

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


This is getting philosophical more than technical.

Nil is not "unknown" but "no entry". If a table returns nil it has sure no entry and not entry unknown.

If asked in coding logic what waa before the big bang. The appropriate answer would be an exception, not nil. Same as 0 divided by 0 is error and not nil.

Coders and their different notions about zero is from outside just as funny as their need for a half a dozen different brackets. 0, nil, "" and {} all mean in some very different way nothing.

Am 2010 12 15 08:32 schrieb "Dirk Laurie" <dpl@sun.ac.za>:
> On Wed, Dec 15, 2010 at 08:54:59AM +0200, Axel Kittenberger wrote:
>> >    What happened before the Big Bang?  Nil.
>>
>> As empiricist I must say, no. We don't know. Might been Nil, might
>> been something else. Currently no way to guess.
> Exactly my point, actually.
>
> "nil" in lua means "not one of the possibilities that we know
> something about". There is no distinction between something unknown
> and something non-existent. The failure to appreciate this fact is
> what has sparked off the whole discussion on tables whose implementation
> does make that distinction.
>
> For example, if I say
> for i=1,10 do print a[i] end
> and some of those a[i]'s print 'nil', I am not given the information
> of whether that 'nil' is stored as such in the array part, or is just
> missing from the hash part. The "array part" of a table is simply a
> convenient way of not explicitly storing keys that occur very often.
>
> -- 'nil' makes no distinction between 'unknown' and 'non-existent'.
>
> Dirk
>