lua-users home
lua-l archive

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


On Sun, Jan 2, 2011 at 2:26 PM, Greg Falcon <veloso@verylowsodium.com> wrote:
> [...] table.pack() and table.unpack() aren't symmetrical [...]

That was also noted in Renato's reply to Patrick's comments in [1].

> [...] table.pack() might want a metatable where __len returns the larger
> of n and the raw length [to be read by table.unpack]

That would break the current practice that table.* functions ignore metamethods.

> The standard library probably needs a rawlen() function [...]

Nor is there, for that matter, rawtostring, rawipairs, and rawpairs
[2], although rawipairs and rawpairs (and to some extent rawlen) can
be implemented in terms of rawget and next (not called "rawnext").
Non-orthogonal?  Probably.

[1] http://lua-users.org/lists/lua-l/2010-01/msg01435.html
[2] http://lua-users.org/lists/lua-l/2010-01/msg00927.html