it would be nice if arc was to be implemented on the JVM, it will be instantly portable, easy to install .. both of which can boost arc's popularity and adoption
Since Scala is a compiled statically typed language and not an interpreted dynamic one, this technique is not necessary. Where this technique is useful is cases where the method being called is impossible to know until runtime, such as in Ruby or Groovy. Scala, like Java, is not like this and the compiler can be guaranteed to have enough information to generate the right bytecode for the call inline.
The key difference between Scala and Java here is that because Scala uses type inferencing at compile time, the programmer has to provide a lot less of that information than they would in the equivalent Java code.
>Where this technique is useful is cases where the method being called is impossible to know until runtime, such as in Ruby or Groovy. Scala, like Java, is not like this and the compiler can be guaranteed to have enough information to generate the right bytecode for the call inline.
What about polymorphic method calls? Statically typed or not, which method implementation to invoke is impossible to know until runtime.
While the actual implementation method that will be invoked is unknown, in a statically typed language the base class/interface and the method signature are known. In Java/Scala classes the types of the arguments are baked into the method names used by the bytecode so this is important information from a performance point-of-view.
Looking up this information at run-time (via reflection) is slow, but dynamic languages on the JVM have have been forced to do that when calling into Java classes from the dynamic language - which is the starting point of the original article.
Scala is not affected by this because it is not a dynamic language and the Scala compiler has the exact same information that the Java compiler does when it compiles a call from Scala to Java.
Thank you for the thoughtful reply. I only recently started reading about Scala, and haven't actually done anything with it yet (I have done some experimentation w/ Groovy and Grails). I'm pretty sure I understand your explanation - thanks a bunch!