Skip to content

Instantly share code, notes, and snippets.

@kiritsuku
Created February 10, 2013 17:31
Show Gist options
  • Select an option

  • Save kiritsuku/4750334 to your computer and use it in GitHub Desktop.

Select an option

Save kiritsuku/4750334 to your computer and use it in GitHub Desktop.
$ scalac x.scala
$ scala Test
List(Test$B$@4ce32802, Test$C$@5557c2bd)
List(Test$A$@5ef4f44a, Test$D$@23d256fa)
List(Test$A$@5ef4f44a, Test$B$@4ce32802)
List(Test$C$@5557c2bd, Test$B$@4ce32802, Test$A$@5ef4f44a)
List(Test$B$@4ce32802, Test$A$@5ef4f44a, Test$B$@4ce32802)
object Test extends App {
abstract class SuperClass (cs: => Seq[SuperClass]) {
def init {
println(cs)
}
}
object A extends SuperClass(Seq(B, C))
object B extends SuperClass(Seq(A, D))
object C extends SuperClass(Seq(A, B))
object D extends SuperClass(Seq(C, B, A))
object E extends SuperClass(Seq(B, A, B))
object Initializer {
def init {
A.init
B.init
C.init
D.init
E.init
}
}
Initializer.init
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment