Mixed compilation

1 view
Skip to first unread message

rssh

unread,
Jul 7, 2009, 5:21:35 AM7/7/09
to JVM Languages
Yet one potentially interesting areas for collaboration can be 'mixed
compilation for JVM', where we have set of sources in different
language (may be mutually dependable) and some 'meta-compiler' which
can generate code from different languages, calling compilers for
concrete languages.
As I know, now mixed compilation just work for groovy+java, scala +
java, and scala+groovy+java.
(http://groovyland.wordpress.com/2009/03/03/groovyscalajava/)
It would be great, to have standard API for compilers (as I
understand - with two operations:
(1.A) - generate 'definition' class files for given source file
(without resolving internal dependencies)
// or may be just publish dependency information in some form.
(1.B) - generate 'implementation' class files for given source file.

I guess, (A) is possible not for all languages (for example - when we
want in X to reexport methods of Y, it is impossible to generate class
file for X, without compiling Y).

So, questions are:
- are anybody also thinking about such possibility ?
- what can be potentially safe meta-compiler protocol ?


Charles Oliver Nutter

unread,
Jul 7, 2009, 4:42:28 PM7/7/09
to jvm-la...@googlegroups.com

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

Reply all
Reply to author
Forward
0 new messages