如果您尝试使用后缀运算符,您将收到一个错误,并附有以下解释:
scala> Seq(1, 2, 3) reverse
^
error: postfix operator reverse needs to be enabled
by making the implicit value scala.language.postfixOps visible.
This can be achieved by adding the import clause 'import scala.language.postfixOps'
or by setting the compiler option -language:postfixOps.
See the Scaladoc for value scala.language.postfixOps for a discussion
why the feature needs to be explicitly enabled.
具体来说,它指出:
请参阅 Scaladoc 中关于 scala.language.postfixOps 值的讨论
这个讨论在哪里?当我查看2.13 scaladocs 条目及其postfixOps
伴随对象时,他们没有讨论或解释此特征/对象的存在:
以及伴随对象:
正确的查看位置是
scala.language.postfixOps
。