lua-users home
lua-l archive

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


On Tue, Feb 28, 2012 at 6:13 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>> This is one of those cases where function declaration syntax inside a
>> table would work for some kinds of use too:
>>
>> switch(c, {
>>   function p() print(a) end;
>>   function q() os.exit() end;
>>   function e() eval(args) end;
>> })
>>
>> but that's dependent on the cases being suitable as table keys.
>
> I.e. the cases must not be nil of NaN?

How did the nil make it past my assert?

There's no particular reason why [[s = "f"; function [s]() end]]
shouldn't work. And then I think about [[local function [s]() end]]...

The first rule of NaN is: you do not talk about NaN.

    nan=0/0; assert(not (1<nan or 1>nan or 1==nan))

The second rule of NaN is: you do not talk about NaN.

    assert(not(nan==nan))

The third rule of NaN is signalling NaNs mean the fight is over.

Jay
"This is my quiet NaN. There are 2^52-2 doubles like it, but this one is mine."