[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Questions about 5.2 standard library [table.unpack and rawlen]
- From: David Manura <dm.lua@...>
- Date: Tue, 4 Jan 2011 02:01:42 -0500
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