Skip to content

Instantly share code, notes, and snippets.

@kaja47
Created October 3, 2012 11:35
Show Gist options
  • Select an option

  • Save kaja47/3826509 to your computer and use it in GitHub Desktop.

Select an option

Save kaja47/3826509 to your computer and use it in GitHub Desktop.
Reflection or not?
class A {
def callThis = println("YOU MANIACS! YOU BLEW IT UP! OH, DAMN YOU! GODDAMN YOU ALL TO HELL!")
}
val a = new A
a.getClass.getMethod("callThis").invoke(a) // reflection
a.asInstanceOf[{ def callThis }].callThis // duck-typed reflection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment