> 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 my opinion the example given is awful code, yes we should protect developers from themselves but good taste in code is important and incrementing a counter easily should still be a thing. Just stop the bad cases then rather than the well understood and expected usage.
Yes, sorry, I should have said sequence points also.
> Note that even "=" is a statement in Go.
In Python and Rust as well.
Nitpicking: assignment is an expression that returns () in Rust, meaning `foo(a = 1, a)` is valid if foo has a signature like `fn foo(x: (), y: i32)`. However, arguments are (mostly) defined to be evaluated from left to right.
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.