This is completely unrelated. Implicits in scala are fully resolved at compile time . The compiler inserts what you could write yourself. If he cannot do this, an error occurs during compilation. InvokeDynamic is a search for a method at runtime and a failure at runtime if it cannot be found.
In particular, if you write in scala xm() , where there is no method m in type x, it will look for an implicit conversion, that is, a function, say f, that is in scope (you could call f for now), which marked as implicit , which will take x as a parameter, and the result of which has a method m (the rules have much more details, but this is the essence). If he finds such a method, he will replace xm() with the correctly printed f(x).m() . It could also be written in code, and it would have to be in java. If such a function f is not found, then a compile-time error occurs.
This happens the exact same way if you call g(x) and x not for the correct type to be passed to g . If there exists a function f such that f(x) is of the correct type, then it will replace the code with g(f(x)) . Again, you could write this in a simple scala, and again, if there is no such method, it will not compile.
Dynamic does not have to worry too much at compile time if the method m exists in x and looks for it at runtime. This is how a dynamic language works, such as JRuby or Groovy. There is something about scala that is characteristic of Dynamic (labeled experimentally).
source share