lua-users home
lua-l archive

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


Rena> I often felt there'd be a lot less confusion about the table
Rena> library if it were named 'array' instead.

This.

Steve> Quite so!  The discussion has been about the rather
Steve> slippery nature of Lua tables

And this is the same I thought to be the underlying problem. Haziness
of data structures. I won't say Lua should come with them, and I don't
want to iterate another spin of the much repeated play "we need a
common base library".

My suggestion back then was, and I still haven't seen a good refute
of, remove any default meaning of #. # is what __len says it is. And
if you want it to behave like it is now, set __len to table.edge or
better array.edge. So no one is ever going to be surprised, and if
__len is not set, it throws an error.

Anyway I don't have any quarrels about the length operator, I can do
fine with it, and in my project I did create my own a bit more
sophisticated datastructures like a sequence factory which´ objects
throw an error when anything is set that doesn't fit the sequence, so
no holes ever. I think its good to remember, people are arguing in
these plays, because they care about Lua beyond their own mundane need
:-)