Path-dependent types: accessing outer class

So, AFAIK, Graph#Node should not even exist anymore. I am a bit lost on the details, because I do know the syntax was re-added for cases where it is safe, but I never understood when it is safe. This is what I meant before when I said: " Thus, it is impossible to talk about the Node type without a Graph value". As far as my limited understanding of all this goes, this doesn’t make sense.


I tried to make this in order to be able to talk of any GenNode but still it doesn’t work: Scastie - An interactive playground for Scala.

I haven’t been able to find a way to say that the Node.Graph type should be a GenGraph whose Node type is the same type of the GenNode.
Mainly because there is no way in Scala to refer to the type of the class of this; only to this.type

1 Like