lua-users home
lua-l archive

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



OTOH, I'd also like a bunch of other little changes
(e.g. more flexible behavior to allow natural use of
0-based arrays)

Hmmm. A "pun of contradiction" there. Natural use of arrays means to start at one, of course. (Since natural numbers do.)

The late Edgser Dijkstra argued (25 years ago) your way about arrays, but I just don't buy those arguments.

When dealing with C-type arrays, zero-basing them is clearly 'correct' because of how they work in memory.

When you aren't responsible for managing memory layout yourself, why wouldn't you choose to write:

for i = 1,n do
  -- you have n things to do
  -- start at the first thing to do
  -- and finish with the nth
end

I would like to see bimodal tables, though.

I'm aware that they aren't necessary (I argued that the last time this thread came up) but the weirdness with nils in {...} seems to be a problem which it's incorrect not to provide a -generic- solution for.