It is completely unrelated. Implicits in scala are fully resolved at compile time. The compiler inserts something that you could as well have written yourself. If it cannot do that, at compile time, there is an error. InvokeDynamic is about finding the method at runtime and failing at runtime if it cannot be found.
Specifically, if you write in scala x.m()
where there is no method m in type x, it will look for an implicit conversion, that is a function, say f, which is in scope (you could call f at this point), which is marked as implicit, which will accept x as a parameter, and whose result type has a method m
(there are a lot more details in the rules, but this is the essence). If it finds such a method, then it will replace x.m()
by the properly typed f(x).m()
. It could just as well have been written that way in the code, and it would have to in java. If no such function f can be found, then there is a compile time error.
It happens just the same way if you call g(x)
and x
is not of the right type to be passed to g
. If there is a function f
such that f(x)
has the proper type, then it will replace the code by g(f(x))
. Again, you could have written that yourself in plain scala, and again, if there is no such method, it will not compile.
Dynamic is about not worrying too much at compile time whether there is an m
method in x
, and looking for one at runtime. This is how a dynamic language like JRuby or Groovy typically works. There is something related in scala, trait Dynamic (marked experimental).