lua-users home
lua-l archive

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


2009/4/27 Mike Crowe <drmikecrowe@gmail.com>:
> Timothy Baldridge wrote:
>>
>> Ahhh, the classic argument. Nil and zero are not the same, zero
>> represents the lack of quantity of something being counted, nil
>> represents the lack of data. In some areas of computing (such as the
>> database work I do) this is a major difference. In my mind,
>> tonumber(nil) should return nil.
>
> Actually, I'm not arguing that nil == 0, but asking if tonumber(nil) == 0.
>  i.e. if you move nil into the numeric domain, should it's value be 0...

I don't see tonumber as taking something into the numeric domain, I
see it is converting something already in the numeric domain to a
numeric representation. The string "123.45" could already "represent"
a number, it just has a funny storage format. The same isn't really
true of nil.

    Henk