What does => mean at the beginning of a Scala class definition?
The default naming for class itself is this
. You may replace it with t
by t =>
It is useful if your class contains subclasses and you need access to enclosing self reference.
Without t =>
in your example you would write something like this:
abstract class Thing {
type G <: Group { type A = this.A }
}
Group { type A = this.A }
is a subtype so this
would reference to group specialization itself not to a thing object. Probably you get not what you mean to get. If you need access to Thing self reference you should resolve name conflict by assigning self reference another name
abstract class Thing { another_this = >
type G <: Group { type A = another_this.A}
}