I was surprised to see that this doesn’t compile:
val && : Int = 5
&& + 1
It doesn’t compile because it parses the same as val && : Int = 5 && + 1
. The spec is not terribly clear on whether this is intentional – it says that
… if the operator appears on its own line, the next line must have at least the same indentation width as the operator.
but it does not explicitly state what happens when the operator is not on its own line.
I find it very surprising that, in a language with significant whitespace, it is not required that multi-line expressions be indented. All examples in the linked doc are indented and I think that this the de facto standard.
Is it too late to change the parser behavior here?