lua-users home
lua-l archive

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


On Oct 2, 2013, at 6:27 AM, Andrew Starks <andrew.starks@trms.com> wrote:

> 
> Tim,
> 
> I follow your logic, but could you define "sequence" in the context if Lua?
> 
> What would you propose should happen when I have a table that I wish to treat as a sequence and also as a hash, for keys that are non-numeric? What about a table with integer keys that have no holes, but also have floating point values or 0/negative keys?
> 
> I think you'd agree that Lua has been somewhat successful, so far. So, how much speed is this feature worth? If another complex type is needed, then is it worth that complexity?
> 
> If I'm interacting with a C library that promises that I'll receive a sequence, is it appropriate for me to double check that fact in a scripting language?
> 
> If I'm parsing text input, such as JOSN, it seems like I can scan for a sequence pretty efficiently, but I could be wrong...
> 
> I too have wanted a sequence. I'm surprised there isn't a library for one, actually. If tables could report that their numeric keys were in a sequence and it cost me nothing in speed and only a function call tucked into the "table" library, in terms of complexity, then I'm all for it. But if not, then Lua is fine for what Lua does, IMHO. 
> 
> Your reasoning seems compelling and your reputation speaks for itself. It's too bad that the tone was over the top and unnecessarily disrespectful.
> 

I meant sequence as the term in used in the Lua Reference Manual:

"We use the term sequence to denote a table where 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'm sorry the tone came over that way .. i was a little exasperated to be sure, but not (in intent) disrespectful.

I don't think we need a new complete type to fix this, I think there is a subtle fix.

--Tim