Wat? Scala (Infix Operator Precedence and Associativity)

Nat Pryce pointed out these gems:

Scala Reference 6.12.3

Precedence:
“The precedence of an infix operator is determined by the operator’s first character.”

Associativity
“The associativity of an operator is determined by the operator’s last character”

This actually made me cry.

  1. Most languages have got a feature or two which, when you’re explaining them to a newbie, make you want to cringe and say “yeah, I know this sucks but…”. With Scala, these two are near the top of my list.

Leave a Comment