jastrachan | 9 Jul 11:39 2004

Re: Groovy incompatibility with Java

On 9 Jul 2004, at 10:32, Laforge Guillaume wrote:
>> the one thing that would most likely get me using groovy in 
>> production code
>> (sooner rather than later) is if groovyc produced (or had the option 
>> to produce)
>> .class files (or maybe even java source code?) that didn't require 
>> any redistributables
>> to execute. I don't know how realisitic this is, and if the only way 
>> of doing it was
>> equivalent to "generating" the pre-written runtime in the groovyc 
>> output directory
>> then that's probably not worth looking into
> groovyc (the Groovy compiler) doest definitely produce .class files 
> directly.

Just to be clear - I misread the above sentence first time through. 
Groovyc does create .class files. Groovy always turns scripts into 
bytecode - the main difference with groovyc is that the .class files 
are written to disk, like javac

> It compiles Groovy source code into fully compliant and valid bytecode 
> for the JVM.


> We don't produce Java source code either. But I guess it would be 
> feasable by mapping our AST (Abstract Syntax Tree) to the one of Java 
> (as built by the javac compiler). Currently, we don't have plans to 
> support that, though we've had some discussions to use Java's syntax 
> tree instead of our own.

Agreed - there's no reason why we couldn't turn create a pre processor 
- i.e. turn groovy code into java source code - though I'm not sure how 
useful that'd be.