lua-users home
lua-l archive

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


I thought the undef proposal[1] was nice, but I don't think it
addresses the issue fully. I would like, ideally, to be able to use a
json or msgpack library without having to learn how the json or
msgpack library tries to decide which tables are maps and which tables
are arrays. So I would like a data type for arrays, which know their
own size and can contain nils, and a separate data type for maps,
which probably also know their own size but maybe cannot contain nils.

Roberto commented[2] that this could be bad because it slows down
table access by adding a check for the type of the table. I don't
think this needs to be a net slowdown though, since the code for
looking for integer keys in the array-part and hash-part of tables
could be removed.

[1]: http://lua-users.org/lists/lua-l/2018-03/msg00155.html
[2]: http://lua-users.org/lists/lua-l/2018-03/msg00434.html