lua-users home
lua-l archive

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


On Mon, May 2, 2011 at 10:32 AM, Benoit Germain <bnt.germain@gmail.com> wrote:
> #... is a faux-ami, much better understood as
> local a = ...
> local n = #a

There are two dimensions to any change in a language; efficiency and elegance.

This patch optimizes a rather particular case; unless select(i,...)
were similarly optimized, then I doubt that the even most sensitive of
tests would detect any difference. Mostly, we just use table.pack(...)
which is pretty fast, and would be faster than having to resort to
select(i,...) anyway.

Elegance:  I think #... pretends that ... is a variable, which it is
not. It is shorthand for a number of unnamed parameters and
semantically behaves just like 'a1,a2,a3' etc.

steve d.