标签: scala
以下代码中a=>的含义是什么?它是实例化对象的this指针吗?
a=>
this
class A { a=> def methodB()={ ..... } }
答案 0 :(得分:5)
它被称为自我引用或自我类型。在您的情况下,它意味着“创建名称'a'的符号并将其指向此引用”。
有关详细信息,请参阅“自我引用”(第17章)一节中的SO Scala tutorial:
自我引用 Unify types Self reference naming Multiple self references Difference between self references and subtyping 醇>