Reconciling method overloading and dynamically typed scripting languages
The Java virtual machine (JVM) has been adopted as the executing platform by a large number of dynamically typed programming languages. For example, Scheme, Ruby, Javascript, Lisp, and Basic have been successfully implemented on the JVM and each is supported by a large community. Interoperability with Java is one important requirement shared by all these languages. We claim that the lack of type annotation in interpreted dynamic languages makes this interoperability either flawed or incomplete in the presence of method overloading. We studied 17 popular dynamically typed languages for JVM and .Net, none of them were able to properly handle the complexity of method overloading. We present dynamic type tag, an elegant solution for dynamic language interpreters to properly interact with Java objects in the presence of overloaded methods. The idea is to embody a type annotation in a Java object reference. Java references may be annotated in order to properly determine the signature of methods to invoke. We demonstrate its applicability in the JSmall language and provide the pellucid embedding, a formalization of our approach.
interoperability dynamic languages multi-language system smalltalklite javalite