[...]
The only good argument I’ve seen for using “n” over a first-class
length (that is, being able to assign to #t) is that space is only
allocated for the length when it’s needed. However, I just ran a
crude benchmark and (on a 64-bit Mac) Lua seems to be allocating 82
bytes of space for an empty table,
so adding 8 bytes per table (for the length) isn’t much, and might
even be free since most heap allocators round allocations up to
multiples of 16 bytes or more these days anyway.
My personal feeling is that we need a first-class explicitly set
length. If this isn’t set for a given table (is nil), then Lua uses
current # behavior, as do things like table.pack().