Which characters can I omit in Scala?

后端 未结 2 829
一生所求
一生所求 2020-12-05 07:33

In Scala, why can I omit the dot and brakets in T m 0 (instead of T.m(0)) in the following?

scala> object T { def m(i:Int) = 0 =         


        
2条回答
  •  醉话见心
    2020-12-05 07:58

    I believe the operator syntax style works only when you've got an explicit object on the left-hand side. The syntax is intended to let you express "operand operator operand" style operations in a natural way.

提交回复
热议问题