lua-users home
lua-l archive

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


This reminds me a lot of the controversial new feature they want to add
in Ruby where [1,2,3].inject{|a,b| a+b} turns into [1,2,3].inject{@1+@2}

I think it's a terrible idea in Ruby, which is already bloated, but
adding a similar thing to Lua seems like an even worse idea.

It looks and feels like some Perlism, will be hard to remember for
people learning the language and doesn't even save you that much typing
in the end.

As much as I hate Javascript and the browser API, I'm going to use it as
a very positive example for naming certain features; while code like
`document.getElementById` is cumbersome to type, it makes it completely
clear what it does. Considering code is usually read more often than it
is written I think it is many times better than esoteric expressions
like jquery or languages like Perl provide. Languages that cater to lazy
programmers who want to type a bit less always end up being hard to read
in the process. Sacrifice maintainability to save maybe a few seconds of
typing per work day. Not a good trade-off if you ask me.

On 14/08/2019 03:30, 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.
>
>> [I] hate Perl and it's implicit magic ...
> Same, though I don't think this is much more magic than
> the existing method call syntax.