Some Scala APIs alias this to self, for example,
trait Function1[-T1, +R] extends AnyRef { self =>
I know how this aliasing works in general, but don't see how traits such as Function1 benefit from it. Function1 does not use self anywhere in its definition except for the initial mention, so what is its purpose here?
Variants of this question have been asked previously, but the answers are not directly applicable. Answers have discussed self types and inner classes, but I don't see how that applies here.
this
in the outer scope ifFunction1
is wrapped inside another class/trait. – Inhospitableself
alias forthis
visible to derived types? If so, perhaps there's a dependency on it somewhere else in the library? – Assassin