[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: The += operator, again
- From: Domingo Alvarez Duarte <mingodad@...>
- Date: Thu, 6 Dec 2018 11:43:51 +0100
Hello David !
I would appreciate if you could give a look at
https://github.com/mingodad/ljs and give your point of view, knowing
that you have been advocating for such features so long.
I understand you didn't like patches and or forks but anyway I'll
appreciate if you could find some spare time and give it a try.
Thanks again for your time and attention !
On 05/12/2018 23:50, David Favro wrote:
On December 5, 2018 11:59:47 AM UTC, Domingo Alvarez Duarte <email@example.com> wrote:
I've updated the repositories with fixes for compound operators on
upvalues and also added pre/pos increment operators "++/--".
How do you differentiate "--" as an operator from a comment-start?
I have been an advocate for the += operator, which I think is sorely lacking in Lua, for many years . But in my opinion ++ and -- are much less useful, and when used give fewer advantages , and pose more issues, such as already being used for comments. Yet for some reason people can't help lumping them all together and then using the issues with the unary operators as a purported complication of the binary operator, as well as increasing the overall size of the addition to the language, leading to objections of 'bloat'.
: I mean in core Lua. I consider patches and forks to be vastly less useful.
: ++ and -- are very frequently used in languages such as C for loop iteration. In Lua, iteration takes place much more often via ipairs(), and even the numeric for loop does not require explicit increment. Furthermore, the ++ operator in C often compiles to a distinct hardware instruction; while in the Lua VM, it would presumably generate code no different than "x+=1" .