JRuby is very likely going to need a dual compiler soon, as we start
adding more Java type capabilities. It may not, however, be as
necessary as for Groovy, since most of JRuby's type-lookup logic can
be deferred until actual runtime.
In Groovy's case, I know they actually seek out the types you specify,
so they need to be available during compilation. But is this a real
requirement? All that's really needed in many cases is the package +
class name for inserting into generated signatures.
"Ljava/lang/String;" is enough to build a signature that takes String.
There are certainly needs to be able to load annotations and
enumerations, but it seems like the joint compilation needs there are
greatly reduced.
Joint compilation is also dependent on having some shared
representation of types. In JRuby, we are going to be exploring how to
bring Ruby and Java types closer together to make more integration
scenarios possible (or simply easier than they are today). Ruby types
currently are not represented in terms of Java types, so we'll need to
consider whether we should do that or just have a separate compiler
pass that is aware of Java types. We are working on the new compiler
now.
I'm definitely interested in joint compilation strategies, especially
if we could do them in ways that support many languages without
bootstrapping each compiler anew.
- Charlie