lua-users home
lua-l archive

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

> Is there any chance that the table entry used to
> store the number of elements, ie. n, can be
> renamed to something less likely to cause a name
> clash with user code?
> eg. _n or __n__

How about not giving it a name at all, but rather making it a hidden
property of a table?  Then, if you want to get to the value, one would call
a function like getn(table).  I wonder how much existing code that would
break-- that is, how many people use table.n as a rough synonym for getn()?

No matter what name you pick, *someone* will eventually toss data in a table
that's the same name as this variable.  I love Lua, but this is one of my
pet peeves of the language.  The size of a table should be an intrinsic
property of the table-- not a member of the table.  I can see the value of
making it optional-- but not the value of making it a member.