lua-users home
lua-l archive

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

On Wed, Aug 14, 2019 at 4:05 AM Griffin Rock <> wrote:
> >     veryLongName = trim(x,@,z)
> >     line = @:gsub('%s+',' ')
> >     veryLongName[complexLValue] = @ + 1
> >
> > This still shows the assignment, which in my book is still important.
> Agreed - I like your idea better.

Summarizing the proposal to: An `@` on the right side of an assignment
is replaced with the old value of the first variable on the left side.
(Another token instead of `@` can be used).

As you, I also think that it solves several "Ugliness" of the code,
e.g. the long identifier repetition, or the "a = a + 1" lines due to
the absence of "+=" operator.

The only conceptual drawback that I can find is the following. Right
now I can easily recognize the places where a variable is read, but it
could become tricky in lines like `long_name_1 = func( long_name_2,
long_name_3, @, long_name_4 )`.

Moreover, there are the usual criticisms: it is another syntax to
learn, does it worth? Does it introduce too complexity to the parser?
And so on.

Probably we need a patch to give it a try.