A Grumpy Computer Scientist
2 min readOct 16, 2021

--

The article never makes a valid argument on why we should retire these.

Several inaccuracies and wrong assumptions marr the argument: ++ and -- are just called increment (and decrement) operators, not auto-increment. No one calls them that. What would "auto" be insinuating? That they increment stuff without the programmer knowing? Well, no, they increment the value of a variable, deterministically, exactly when one expects them to. And yes, in B, C, C++ and many other languages it is ok to change values of variables. There is nothing wrong with it. In fact this is what increment/decrement operators are designed to do, it's not a side effect, it's their *expected* effect.

Moreover I can’t find a source that indicates ++ is modeled on PDP’s (Rn)+ that does more than just incrementing, it dereferences. Instead, more simply, CPUs since before the PDP (e.g. the i4004 and even the Four-Phase-Sytems) have had increment operators in their instruction sets that simply incremented a register by 1. These are of course still there, in every CPU, should we get rid of those too?

The author seems to assume that ++ is bad because they want to program in some functional style. If that is the case they should use a functional language which most probably won't have increment operators. It seems pointless to criticise constructs of some programming language from the standpoint of wanting to use a different paradigm.

If that is a trend, soon we'll see an article criticising the lack of OO constructs in haskell, and one criticising the adoption of winches on sailing boats, from the a point of view of car drivers ;)

--

--

A Grumpy Computer Scientist
A Grumpy Computer Scientist

Written by A Grumpy Computer Scientist

UK-based AI professor interested in AI, mind, science, rationality, digital culture and innovation. Hobbies: incessantly fighting nonsense.

No responses yet