lua-users home
lua-l archive

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


2009/6/10 Duncan Cross <duncan.cross@gmail.com>:
> On Wed, Jun 10, 2009 at 11:24 AM, Luiz Henrique de
> Figueiredo<lhf@tecgraf.puc-rio.br> wrote:
>>> local tbl = {ReturnSixIncrementalValuesFromZeroToSix(), 7, 8, 9} -- this
>>> would equate to doing {1, 2, 3, 4, 5, 6, 7, 8, 9}
>>
>> This is a bad idea.
>
> I had an idea for an explicit syntax for this, that overloads the ... operator:
>
> local tbl = {SixValues()..., 7, 8, 9}
>
> - so that, if the "..." keyword immediately follows an expression that
> could resolve to multiple values within a comma separated list, they
> are expanded. I can't see any way that this could be ambiguous, but I
> haven't thought about it all that much, so maybe I am wrong. It also
> kind of makes sense as "..." already means "accomodate a variable
> number of values", but in this case it would mean a variable number of
> *return* values rather than arguments.
>
> -Duncan
>

local tbl = {... ..., 7, 8, 9}

would be a bit strange, no?

    Henk