Implementing inner traits in Scala like we do with inner interfaces in Java
问题 This code in Java compiles without errors: interface T { interface Q { } } class C implements T.Q { } whereas this code in Scala does not: trait T { trait Q { } } class C extends T.Q { } What is the correct translation (if it exists) of the Java code listing into Scala? Theoretical explanations about language design are welcome. 回答1: The inner type Q is defined only for specific instance implementation of the T trait. Since scala has path-dependent types, each instance of T will have his own