News for hackers. Stuff that matters.
Re:Implemented proposals for Swift 3 by munificent on Saturday May 07, 2016 @01:06PM (#11650354)
It's not about operator precedence, it's about sequence points. Assignment—including in ++—is a side-effecting operation. An expression form that does side effects can lead to very confusing code like:

    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.

Re:Implemented proposals for Swift 3 by bjz_ on Saturday May 07, 2016 @09:40PM (#11652199)
> 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.

Re:Implemented proposals for Swift 3 by andy_ppp on Saturday May 07, 2016 @07:14PM (#11651809)
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.
Re:Implemented proposals for Swift 3 by kinofcain on Saturday May 07, 2016 @01:56PM (#11650588)
Yes, sorry, I should have said sequence points also.
Re:Implemented proposals for Swift 3 by masklinn on Saturday May 07, 2016 @01:23PM (#11650426)
> Note that even "=" is a statement in Go.

In Python and Rust as well.

Re:Implemented proposals for Swift 3 by dbaupp on Saturday May 07, 2016 @11:02PM (#11652430)
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.