lua-users home
lua-l archive

Re: [Proposal] Extend no-parenthesis notation to variables

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


On Sun, Oct 20, 2019 at 12:03 PM Mattia Maldini
<mattia512maldini@gmail.com> wrote:
>
> > I think you could achieve the same behaviour easier:
> Yes, but only in the specific case of string concatenation; my idea is to have all generic functions with partial argument invocation and space-separated variable parameters.
The problem is that functions are first-class values, and any object
can be callable if its metatable has a __call metamethod.
So what does this do?
x = var1 var2 var3 var4
Does that become var1(var2, var3, var4), var1(var2(var3, var4)),
var1(var2, var3(var4)), var1(var2(var3), var4), or
var1(var2(var3(var4)))? Remember that passing a function as an
argument to another function is perfectly valid and in many cases
desirable, and anything can be callable.
There's too much ambiguity here for what you want.

AltStyle によって変換されたページ (->オリジナル) /