Skip to content

Instantly share code, notes, and snippets.

@kmizu
Created February 6, 2014 10:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmizu/8841844 to your computer and use it in GitHub Desktop.
Save kmizu/8841844 to your computer and use it in GitHub Desktop.
object ImplicitParams {
trait C[A]
}
object ModuleA {
import ImplicitParams._
import ModuleB._
def foo[A](a: A)(implicit c: C[A]) = bar(a)
}
object ModuleB {
import ImplicitParams._
def bar[A](a: A)(implicit c: C[A]): C[A] = c
}
@kmizu
Copy link
Author

kmizu commented Feb 6, 2014

ここで、barのimplicitな引数cの正確な型がModuleB.scalaのコンパイル時にわからないことを持って「動的ディスパッチ」と言っていいかどうか。これって単に多相関数の呼び出しがネストしたときの一般的な話では?というのが自分の見解。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment