Yield in for comprehension should have higher precedence than method invocation

After reading the whole conversation, it seems to me that all of you are right and it’s really difficult (if possible) to find a solution that would satisfies everybody. But please think about backward compatibility and reusability of the existing code. Changing precedence is going to break a lot of existing code. And more important, it will definitely create a lot of confusion between developers. Visually identical code snippets pasted from GitHub or some blogs will suddenly stop working just because of changed keywords precedence to satisfy someones aesthetic needs. That would be really terrible.

2 Likes

Also, from the coding style perspective it’s good to break those long complex statement in smaller pieces anyway. Especially if the construct has a potential semantic ambiguity.

1 Like

I could imagine that the transition to Dotty with its rewrite tool is an oppertunity for such changes. In addition, I doubt that there are many places where there is a method invocation on a curly enclosed else or yield block. It is even more unlikely that such code would continue to compile after such a change with unexpected different results.

I think if changes break a lot of existing code they must be really needed.

For example I think if improvement

But this sip is rejected, so I do not understand why “yield” should be changed.