foo(a++, a++);
What values get passed foo()? In some languages, it's undefined (!). In others, there is a well-defined answer, but even there the answer may not be intuitive. Removing assignment expression forms avoids this. Note that even "=" is a statement in Go.It does sacrifice a little expressiveness. But in languages that have dedicated syntax like ranges for iterating over sequential numbers, the ++ and -- operators end up pretty rarely used so it's no big loss.
This is one of the big points too, that often gets overlooked. The removal of ++ fits nicely with the removal of C-style for loops.
In Python and Rust as well.
I'm also willing to accept that I'm old, stubborn, and unhappy about changing my ways and that this is the future... :)
I can't even think of a time where I really needed a use-then-increment operator where I wouldn't have just used the value, then incremented it on the next line anyway (maybe even with a post-increment out of habit).
int arr[5];
int i = 0;
while (shouldIKeepGoing() && i < 5) arr[i++] = getAThing();
If you use ++i there you'll skip 0 and overflow the array. This is what the postfix form is for, if you value terseness.Edit: To clarify, I'm not necessarily saying you don't know that's what it's for, but this is a pattern I see pretty frequently in the wild so I'm just throwing it out there with an explanation of why people find value in it.
I use ++x very infrequently, and mainly in hand-written text parsers.
int x = 0;
printf("%d %d", x++, x++);
print? Is that true for all systems and compilers? (Answer: nope!).C:
int foo = bar ? 2 : 4;
Go: foo := map[bool]int{true:2, false:4}[bar]
Python had a similar trick before 2.5 added ternary conditionals.
The pie chart is probably severely lopsided.
EDIT: Since the main problem is the precedence of the post increment/decrement operator, I would have preferred to see them get rid of that one and keep ++foo but overall not much of a loss.
At least they didn't get rid of the ternary operator like Go did...