lua-users home
lua-l archive

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


On Mon, Apr 14, 2014 at 1:28 PM, John Hind <john.hind@zen.co.uk> wrote:
> It would be neat if Lua could support indexing semantics on the vararg
> operator:
>
> n = #... -- number of varargs.
> v = ...[2] -- recover vararg by index.

Yes, because there wouldn't be the C call overhead of select(). On the
minus side, yet _another_ operation baked into the VM, with possible
degradation of overall performance.  With dynamic language design,
this is a slipperly slope, down which (arguably) Python and Ruby have
gone down, making them a lot harder to implement really efficiently
(cf LuaJIT with comparable Python projects)