What I’d like to accomplish is something similar to this:
class Foo( val bar: String = "Hello!" ) extends MyTrait[ Foo ]
trait MyTrait[ T ] { self : T =>
T.bar
}
Changing self : T to self : Foo obviously works, but MyTrait may extend another class that also has bar, so self : Foo isn’t acceptable.
I’m probably going about this wrong, any ideas?
I think, structural type is what you need: