[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Definition of table.insert
- From: David Kastrup <dak@...>
- Date: Mon, 10 Jan 2011 11:50:26 +0100
Axel Kittenberger <axkibe@gmail.com> writes:
> Proposal a function table.icopy(table, src, dest, n) which replaces
> the need for insert and remove.
One could instead just give table.insert a fourth argument defaulting to
#table in case that one messes around with table bad enough that #table
is not going to be a reliable end of range indicator.
But I don't see that this leads anywhere sensible. If one wants to
maintain tables with holes, one should create a _proper_ hole value
different from nil and/or overload #table. nil is _not_ a proper table
element value, and it gives the table implementation a _wrong_
indication about where the continuous section is supposed to end.
Putting nil in continuously maintained arrays will cause vast
performance problems and unpredictabilities.
Just don't. nil is there for a reason, and that reason is _explicitly_
not being a table element.
--
David Kastrup