Avoid unicode versions of ASCII operators

ASCII operators (such as ->) should be preferred over their fancy unicode equivalents (such as ).

Reasons

Not equivalent to their ASCII counterparts

While they’re supposed to be equivalent, they’re not, at least as far as priority is concerned:

This makes the following code legal:

1 -> 4 / 2 // Equivalent to 1 -> (4 / 2)
// res0: (Int, Int) = (1, 2)

The following code, on the other hand, isn’t:

1  4 / 2 // Equivalent to (1 → 4) / 2
// error: value / is not a member of (Int, Int)
// 1 → 4 / 2 // Equivalent to (1 → 4) / 2
// ^^^^^^^

This violates reasonable assumptions about the behaviour of unicode operators, and is an accident waiting to happen. Better to avoid them altogether and rely on fonts with ligature support or editor support for fancy display.

Soon to be deprecated

As it happens, the feature is controversial enough that it’s going to be deprecated in an upcoming Scala version.

Checked by

LinterRule
Scalastyle