lua-users home
lua-l archive

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


On Thu, Jun 7, 2018 at 7:34 AM Egor Skriptunoff
<egor.skriptunoff@gmail.com> wrote:
> Every Lua table must store 8-byte integer "high water mark" (biggest non-zero positive integer key assigned).
> User can read it with function table.hwm(t)

I also think this, or something like this, should be the way to go.
For me this could become the final lua solution. Somehow similar
proposal was in http://lua-users.org/lists/lua-l/2018-03/msg00395.html
.

I do not want to disscuss here the datails of the syntax or
implementation, however I think:

- Cons #3, for me, is a Pros (no new type / metamethod)
- A smart implementation can avoid the fixed 8 byte cost (e.g. keep it
associated to a special key of the hash part?). Yes, I know, smart
hacks should be avoided...
- A table opereator is better than a function (i.e. table.hwm); we
will end with two table ops, e.g. % and # , one for max index, one for
border (that I still found very usefull).

I really would like to hear by the lua team why this kind of solution
was discarded (I am quite sure they already examined it).