标签: scala
找到here奇数类型注释:
trait Filter extends EssentialFilter { self =>
这是什么意思?
答案 0 :(得分:3)
它只为this创建别名。将此视为可能的用例:
this
trait Foo { self => def name: String case class Bar(val name) { def showNames = println( s"My name: ${this.name}, foo's name: ${self.name}" ) } }