3 ms·
If the precedence was higher then you'd get a situation like x := 1 if cond else 2 never resulting in x := 2 which is pretty unintuitive. And you have to r
by dataflow 5y ago
If the precedence was higher then you'd get a situation like
x := 1 if cond else 2
never resulting in x := 2 which is pretty unintuitive.
And you have to realize, even if the precedence works out, nobody is going to remember the full ordering for every language they use. People mostly remember a partial order that they're comfortable with, and the rest they either avoid or look up as needed. Like in C++, I couldn't tell you exactly how (a << b = x ? c : d) groups (though I could make an educated guess), and I don't have any interest in remembering it either.
Ultimately, this isn't about the actual precedence. Even if the precedence was magically "right", it's about readability. It's just not readable to assign to a compound expression, even if the language has perfect precedence.