lua-users home
lua-l archive

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


Hm. Well. Undefined is not very cool. Maybe your program happens to
rely on 'undefined' (it might not notice as there is not really an
error message) - and then we try to run it in, say, Kahlua and then it
doesn't work anymore.

Isn't it a lot smarter to have well-defined operators for all common
operations? I mean, we're talking about the length of a list here. Not
something exotic or so. You use that thing every day, all the time.
One nil in there, and the result is undefined? Is that safe?

I don't really think so.

And if it isn't - why don't we join forces and solve that little problem?


On Sat, Oct 1, 2011 at 8:55 PM, joao lobato <btnfdp.lobato@gmail.com> wrote:
> On 10/1/11, Stefan Reich <stefan.reich.maker.of.eye@googlemail.com> wrote:
>
>> It's obviously a binary search to find the highest key. But does it
>> even work? If there are nils in the table, it begins to act randomly.
>> It may, among others, return the key before the lowest nil - or the
>> highest key in the array.
>
> That's why the length operator is undefined for non-sequences.
>
>