3 ms·
> If you leave them in they're one more special case that everyone has to memorize before they can maintain someone else's code It's literally no different tha
by Alupis 11y ago
> If you leave them in they're one more special case that everyone has to memorize before they can maintain someone else's code
It's literally no different than having to remember what "+=" does... which is what's being proposed as the alternative.
> Reading is more important than writing
I would agree, but "x++" is not difficult to read. It's more concise than having to read "x += 1". Or worse, beginners will think it's clever to define constants for this so now you'll get "x += INCREMENT_VALUE", making you have to go lookup whatever "INCREMENT_VALUE" is, etc...
- lmm 11y ago> It's literally no different than having to remember what "+=" does... which is what's being proposed as the alternative. You already have to remember what "+=" does though. If they kept ++ you'd have to learn both.
- Alupis 11y agoI don't get the argument... you have to learn what "+" does, so why not remove that and just have "-" since you can subtract negative numbers to add. The line of reasoning that it is more to learn is ridiculous. The concept of incrementing or decrementing a value is trivial. If "++" seriously trips you up as you learn to program, perhaps programming isn't for you... "+=" is no better. If you're going to campaign against "++", might as well go all the way back to BASIC days and only allow "x = x + 1"
- Retra 11y agox = x + 1 isn't so fun when you're writing long_variable_name = long_variable_name + 1 That's the problem being solved in a modern language. The ++ and -- operators don't add much. They're the perfect a combination of rare, unnecessary, and often ambiguous. Not to mention that their semantics are often different in subtle ways between languages.
- Nadya 11y ago`lon[tab] = lon[tab] + 1` Autocompletion is a wonderful tool that every developer should use, if only to reduce the possibility of `long_variable_name = long_varable_name + 1` in their code.
- aninhumer 11y ago>If "++" seriously trips you up as you learn to program, perhaps programming isn't for you... And by induction you can use this argument to allow any amount of bullshit in a language. >"+=" is no better. "+= x" saves you from "= long_variable_name + x" which is arguably less readable. "++" saves you from ... "+= 1" which is already entirely clear, and I have no idea why anyone feels the need to shorten it. Sure it's a relatively small complexity cost, but it's also an even more microscopic advantage.
- lmm 11y ago> you have to learn what "+" does, so why not remove that and just have "-" since you can subtract negative numbers to add. Because "-" is part of the domain language (mathematics). > The concept of incrementing or decrementing a value is trivial. For a normal function (i.e. something that could be implemented as library functionality) then I agree with you. But for a language-level operator, it's a special case. It probably has its own precedence. It definitely complicates the metamodel. > If you're going to campaign against "++", might as well go all the way back to BASIC days and only allow "x = x + 1" I would. How many times do you need to add 1 to something anyway?