lua-users home
lua-l archive

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


On Monday, October 19, 2015 10:30:12 AM Dirk Laurie wrote:
> The following syntax could be used:
> 
>     ##             -- select('#',...)
>     #index      -- select(index,...) when n is an integer
> 
> All that we would need to sacrifice is the __len metamethod when
> its argument is an integer, since then "Lua knows what to do".

#index would be a problem because we don't know at compile time if index is an 
integer or something else. The whole point of this would be to fast-track 
access to elements in the argument list.

Rather than add line noise, could we elevate select to a keyword? Or perhaps 
produce an optimizing compiler that knows how to inline the function.

-- 
tom <telliamed@whoopdedo.org>