jastrachan | 9 Jul 11:35 2004
Picon

Re: Groovy incompatibility with Java


On 9 Jul 2004, at 10:28, John Wilson wrote:
> On 9 Jul 2004, at 10:13, Andrew Ferguson wrote:
>
>> hi,
>>
>>  since you seem extremely open to constructive criticism.. :)
>>
>>> Perhaps we'll add some more Java "compatibility"
>>
>> 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
>
> This really isn't an option. The generated bytecodes need some 
> standard classes (Like groovy.GroovyObject) and because you can 
> dynamically compile Groovy scripts it need the groovy compiler and a 
> couple of support jars (for the ASM code generation system)

FWIW the ASM jars are only required if you want to dynamically compile 
some Groovy code. If you're happy to use Groovy as a kinda pre-compiler 
to make .class files and you're not dynamically evaluating any Groovy 
scripts then you don't need to ship the ASM jars.

> If users wanted a minimal system which didn't support dynamic 
> compilation of scripts then we cold produce a reasonably small set of 
> classes which had to be included with the application but it would 
> always be needed

Agreed. If no dynamic compilation is required we could avoid shipping a 
large part of the groovy jar (compiler, AST, bytecode generator etc).

> (unless Sun could be persuaded to make Groovy part of Java 1000!)

:)

>
>
>>
>>> LOL :-) I don't think it may become an obscure code contests :-))
>>
>> I've not delved that deeply into groovy yet, but one thing I saw on 
>> the presentation slides was that you could refer to the end of an 
>> item in an array (or maybe list) by using negative indices. This is 
>> surely the kind of thing that obscure code contests rely on? I think 
>> its because it's a special case that would surprise java programmers 
>> and maybe only caters for a minority need (?), which seems in 
>> contrast to the concise way of allowing access to Get/Set methods 
>> without typing the full name?
>>
>
> It's certainly an arguable point. Personally I find having to do 
> a[a.length -1] noisy and error prone ;)

Agreed!

or

a[a.size() - 1]

if a happens to be a list rather than an array (or a.length() if its a 
string and I can't even remember what to do if its a result set :)

James
-------
http://radio.weblogs.com/0112098/


Gmane