lua-users home
lua-l archive

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


On Fri, Jul 8, 2016 at 9:07 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>     t[#t+1] = newitem
>
> seems to me to be unbeatably concise, and needs only O(log n)
> time, but with the present Lua documentation is unsound code.

Hm, did not Roberto say that this should always work? Or is the joker
__len? Surely any sensible person would implement __len so that this
still works, or throw an error (fixed size).

(I remember when this was considered not unbeatably concise enough, so
e.g. the 't[#] = newitem' proposal)