[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Next Version of Lua?
- From: Duncan Cross <duncan.cross@...>
- Date: Wed, 10 Jun 2009 12:32:52 +0100
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