jastrachan | 9 Jul 11:26 2004

Re: Groovy incompatibility with Java

On 9 Jul 2004, at 03:02, tetsuo wrote:
> Chris Poirier wrote:
> > It is probably best to avoid the idea that Groovy is Java+.

Agreed - though we should try and support, in an unsurprising way, as 
much of what java developers will try and do with groovy.

> Laforge Guillaume wrote:
> > Groovy is not a Java superset, strictly speaking.
> > Groovy supports a Java-like syntax,
> > but doesn't support Java's syntax thouroughly.
> > We have also taken inspiration from other languages such as Ruby or 
> Python.
> > When you paste java code directly in a groovy file,
> > it may work, but it's not a promise that we make.
> > If you really want a Java superset, you may experiment with BeanShell
> > which (AFAIK) supports the whole Java syntax.
> > On the other hand, if you want to live on the edge,
> > and play with some nice syntax sugar, stay on our boat ;-)
> "Groovy can be used as an alternative compiler to javac to generate 
> standard Java bytecode to be used by any Java project or it can be 
> used dynamically as an alternative language such as for scripting Java 
> objects, templating or writing unit test cases."
> This is at Groovy's site frontpage. When did we drop that? Should we?
> Will Groovy be a viable language for real programs, or will it be only 
> an experiment to make us "live on the edge"? The main idea about java 
> is compatibility, between platforms, between vendors, between 
> versions. I think that it's better to create a completely new language 
> (a là Jython) than maintain a 'almost compatible' language, that 
> breaks backward compatibility in surprising and obscure ways.

We're not really going for 100% compatibiity with Java, we're just 
making a new language that feels natural to Java developers.

FWIW the 2 issues that this thread have highlighted is right now today

* variable declarations must be initialised. (We can maybe figure that 
one out & fix it - or at least write it in big letter on the 'what you 
need to know' page for java developers moving to Groovy)

* currently we don't fully support primitive type arrays. We will - 
we've just not got there yet in the implementation.

> PS: Sorry if I'm being annoying. I just don't want Groovy to become 
> the new language of choice for 'obscure code contests' :)

Not at all - we all want the same thing I think.