2 ms·
I 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 o
by Alupis 11y ago
I 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?