1

Found here odd type annotation:

trait Filter extends EssentialFilter {
  self =>

What does it mean?

Mad Penguin
  • 131
  • 1
  • 4

1 Answers1

3

It just creates an alias for this. Consider this as a possible use case:

trait Foo { self => 
  def name: String
  case class Bar(val name)  {
     def showNames = println(
       s"My name: ${this.name}, foo's name: ${self.name}"
     )
  }
}
Dima
  • 39,570
  • 6
  • 44
  • 70
  • 1
    In addition to this answer, I recommend this helpful blog post - http://tpolecat.github.io/2015/04/29/f-bounds.html - which discusses `=> self`. – Kevin Meredith Mar 13 '16 at 03:18