lua-users home
lua-l archive

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


Lars:

On Wed, 27 Jul 2022 at 13:20, Lars Müller <appgurulars@gmx.de> wrote:
> I'd say it would decrease predictability and readability.

me too. May have its uses, and would be fine with it in a language
where the number of results is defined. But in this case the little
gains of

local a,b,c,d = f(), g(); -- assume we know they return two values each.

vs

local a,b = f(); -- assume nearly nothing.
local c,d = g();

does not seem to be enough to allow it. The ability of capturing the
first result for functions which return ( main_result,
optional_details ) is more useful to me. In fact I never use multiple
functions assignement to a local, it seems to be "lua golf".

> I'm not aware
> of any language that treats "," as vararg concatenation.

Well, perl does not have an special vararg ( everything is vararg ), but:

folarte@7of9:~/tmp$ perl -MData::Dumper -e '@a=(1,2);@b=(3,4); sub x
{ print Dumper\@_; } x(@a,@b);'
$VAR1 = [
          1,
          2,
          3,
          4
        ];
folarte@7of9:~/tmp$ perl -MData::Dumper -e 'sub x { return (1,2,); }
@a=(x(),x()); print Dumper\@a;';
$VAR1 = [
          1,
          2,
          1,
          2
        ];

But I personally do not want lua to be like perl ( and I use much more
perl than lua ).

FOS