In Java, < has higher priority than ==. In Scala it’s vice versa. I wonder why Scala people chose that way? Other binary operator precedences align with Java (exept bitwise ops, but it’s understandable why they didn’t give special precedences for those).
UPDATE: It was actually a mistake in the language spec, ‘<‘ has actually higher priority than ‘==’ in Scala.
It’s not inversed in Scala. Try this:
I get a compile-time warning:
comparing values of types Boolean and Int using `==' will always yield false; so obviously the compiler has translated this to5 == (8 < 4), just like in Java.You can try this, too:
Then calling
foo === foo <<< foo >>> fooprints this:Which means it was parsed as
(foo === ((foo <<< foo) >>> foo))Can you provide an example where the precedence is reversed?