Skip to content

Instantly share code, notes, and snippets.

@sndyuk
sndyuk / runtime mock of structual subtyping.scala
Created November 4, 2012 11:45 — forked from xeno-by/gist:4008389
構造的部分型を引数に持つ関数に対して、実行時に引数を動的に作成して渡す
import scala.language.reflectiveCalls
// for the story behind this snippet of code see:
// http://stackoverflow.com/questions/13185405/structural-subtyping-reflection
// requires Scala 2.10.0-RC1 or higher
// you also need to have scala-reflect.jar and scala-compiler.jar on your classpath
import scala.reflect.runtime.universe._
object Test extends App {