As I read from book, scala operator associativity comes from left to right except operator ends with ":" char.
Given the val a = b = c
, it becomes val a = (b = c)
and makes a
is initialized as Unit.
But why does not it become (val a = b) = c
, and it cause that compile error because to use a Unit(returned from a=b
) to receive c
?
And after I really types (val a = b) = c
, the compiler complains illeagal start of simple expression
and pointers to val
. Why are these two assignment operators not grouped from left to right?