Created
December 6, 2013 22:54
-
-
Save jamie-allen/7833551 to your computer and use it in GitHub Desktop.
How to bypass Scala trait linearization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> trait A { def p: Unit } | |
defined trait A | |
scala> trait B extends A { def p = println("b") } | |
defined trait B | |
scala> trait C extends A { def p = println("c") } | |
defined trait C | |
scala> class D extends B with C { override def p = { super[B].p } } | |
defined class D | |
scala> new D().p | |
b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment