更新时间:2023-02-14 19:57:40
是的,它们是必需的。否则,编译器会将代码解释为 x。+(y,z)
而不是 x。+((y,z) )
。
Yes, they are needed. Otherwise the compiler will interpret the code as
x.+(y, z)
instead of x.+((y, z))
.
相反,您可以再次使用ArrowAssoc: x +(y-> z)
。注意,也需要括号,因为 +
和-
具有相同的优先级(仅方法的第一个符号定义其优先级)。
Instead, you can use ArrowAssoc again: x + (y -> z)
. Notice, the parentheses are also needed because +
and -
have the same precedence (only the first sign of a method defines its precedence).