lua-users home
lua-l archive

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



On Oct 2, 2013, at 3:17 PM, D. Matt Placek <atomicsuntan@gmail.com> wrote:

On Wed, Oct 2, 2013 at 5:19 PM, Tim Hill <drtimhill@gmail.com> wrote:
So I'd like to take a moment to float something[...]

"We use the term sequence to denote a table where, at all times for the life of the table, the set of all positive numeric keys is equal to {1..n} for some integer n, which is called the length of the sequence."

I like this proposal.  It clears up a lot of the confusion and is straightforward.  The only thing I don't like is breaking compatibility on how the #t operator behaves (e.g. breaks existing checks like "if #t > 0 then"), which would force a decision on whether to add a new operator alongside #t (and clutter the language) or break legacy code.


Yep, agreed, and you could report the same thing via (say) table.isseq() instead. I only liked the # change since (a) it means that when # goes "off the wall" in the current model it returns nil in the new, and since # can be handled via a metamethod this gives the chance to extend the "nil return" behavior to other abstracted types also.

--Tim