|So getting back to my 3 questions…|
1. Is there a need for an "empty" element within an array (where "empty" as a concept is tbd)?
2. Assuming #1 is "yes", would this be useful as a standardized technique so that everyone uses the same convention?
3. Assuming #2 is "yes", what form should this standard technique take?
You are arguing that the answer to #1 is "no"?
One thing that I find interesting is the amount of discussion here .. this is suggestive of *something* to be sure. Perhaps it's a misunderstanding of the problem, or perhaps there is *some* kind of problem here but people differ as to what it is.
One thing I like about Lua is the intuitive and clean nature of the language. But the Lua concept of a "sequence" to my mind is a bit odd .. it feels more like something that fell out of an internal optimization of table implementation (compact storage for integer keys and fast indexing) rather than a designed feature. This makes the # operator fragile; any 3rd party code or library can "corrupt" an array and make # return arbitrary invalid values and there is no way to discover this that I am aware of. I find this behavior a bit odd, and clearly some of the other posters do as well, as many suggestions here make # more robust (or provide a similar mechanism that is itself more robust).
Why is this relevant? Because my "empty" design (flawed as it might be) makes # more robust by providing a way to have them sparse but still a defined size, and the various other suggestions also do the same by other means.
On Jul 5, 2013, at 1:24 PM, Andrew Starks <email@example.com> wrote: