[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Adding new operators
- From: Francisco Olarte <folarte@...>
- Date: Tue, 18 Jan 2022 16:08:09 +0100
On Tue, 18 Jan 2022 at 14:53, Flyer31 Test <email@example.com> wrote:
> I am quite new to Lua, but I think at least for beginners, it is nice
> and reasonable that Lua skips all these "typical C abbreviations" ++,
> --, +=, -=, *=, ... . Too many operators I think are not helpful,
> especially not for a skript language which should be "learnt easily".
Beginners can easily skip them but, leaving the increment operators
apart, I've found sometimes the op-assign variants are much easier to
explain to complete beginners.
I mean, I routinely says "double the height", "Incement balance by
amount", which are much easier to parse as height*=2 and
balance+=amount. The notation height=height*2 is one of the things
whish is somehow hard to teach to beginners, especially those familiar
with math notation. I think that languages which use := and = instead
of = / ==, or even some which use other notations are easier for the
Of course many of this operations come from native machine code ops,
but even there the Z80 style off ADD A,B is easy to read.
In my opinion those not only save typing, they clarify code. And I miss them.