Possible Duplicate:
Scala this aliasing and self type
I come across this piece of code.
abstract class Tagged(private var t: Int) { self =>
...
}
I know that the following means a dependency relationship of Tagged and B, but could not understand the above one, could anyone explain the difference ? Thanks
abstract class Tagged(private var t: Int) { self:B =>
...
}
The first form introduces an alias for
this; the second form constrains the self-type.For example, in scala.Enumeration,
thisenumis used as an alias forEnumeration.thisfrom nested classes. In the change log appendix to the spec, it says the alias is designed as replacement syntax.