2

Are Groovy 1.x (from http://groovy.codehaus.org) and Groovy++ (from http://code.google.com/p/groovypptest) two separate languages or are they two parts of just one language? Why or why not?

Vorg van Geir
  • 672
  • 6
  • 13
  • possible duplicate of [Groovy And Groovy++,Are they different?](http://stackoverflow.com/questions/5441482/groovy-and-groovy-are-they-different) – Andrew Eisenberg Sep 04 '11 at 03:06
  • @Andrew Whether "Groovy" and "Groovy++" are different, and whether they're one language or two, are two different questions. I've seen arguments that they're two different languages, and are hoping to elicit all the reasons why people think one way or the other in the answers. – Vorg van Geir Sep 04 '11 at 03:10
  • My reasoning is that the question of whether or not they are different languages rather than flavors of the same language is academic (in the negative sense). How will an answer to this question provide any more insite to your understanding than the answers already provided on the duplicate that I linked to? More fundamentally, what are you really trying to find out? – Andrew Eisenberg Sep 04 '11 at 19:40
  • @Andrew This question has many answers, not just one. The link has variations on OverZealous's answer below, i.e that Groovy++ "extends the core Groovy 1.x language". What are other reasons for different opinions? – Vorg van Geir Sep 05 '11 at 07:29

3 Answers3

4

The answer to your question is provided on the Groovy++ website. It's the second sentence on the page you linked to!

Groovy++ is statically typed extension of Groovy programming language.

Groovy++ is an extension to Groovy. It builds on to Groovy, adding true static typing in some or all classes. The goal is performance and other improvements. Again, the page you link to has a complete description.

Recently, Groovy has really improved it's performance, and with the addition of Java 7's invokeDynamic, performance may soon be almost as fast as Groovy++/Java (the difference being mostly negligible).

OverZealous
  • 39,252
  • 15
  • 98
  • 100
  • Because there may be different opinions (and reasons) regarding this question, I'll leave this answer unticked to encourage other answers. – Vorg van Geir Sep 04 '11 at 02:47
  • You wrote "Recently, Groovy has really improved its performance, and with the addition of Java 7's invokeDynamic, performance may be almost as fast as Groovy++/Java (the difference being mostly negligible)". Groovy doesn't yet use Java 7's invokeDynamic, therefore its performance is still slow compared to Java and Groovy++, as these stats show: http://code.google.com/p/groovypptest/wiki/Performance – Vorg van Geir Sep 06 '11 at 12:56
  • You are correct. There has been discussion recently regarding the benefits of invokeDynamic, but it has not yet been implemented. The Groovy user's group and I believe other questions on StackOverflow talking about the benefits of invokeDynamic. I suppose to be precise, I should have written *...performance may **soon** be almost as fast...* – OverZealous Sep 06 '11 at 20:41
1

On a software architectual point of view Groovy++ may be an extension of Groovy.

But if you look at language level: What happens if you use dynamic method invokation and annotate that class with @Typed? The compiler will complain about the unkown methods.

I think Groovy++ is a new language because a @Typed annotated Groovy Class does not allow dynamic calls like a not annotated Groovy Class. It changes the sematic of your code.

Groovy++ is a subset of Groovy.

Peter
  • 4,752
  • 2
  • 20
  • 32
  • Subset ? Class annotated by @Typed **does** allow most of dynamic calls. Groovy++ just is trying to translate them to static types in compilation time. Anyway, you can use **every** Groovy feauture with @Typed(TypePolicy.MIXED). – uhbif19 Nov 05 '11 at 02:56
0

Formally Groovy++ is just Groovy library. Groovy++ even have not any special syntax and uses Java-annotations.

But in fact Groovy++ is Groovy dialect (not new language of course).

@Peter Groovy++ forbids some Groovy libretys (as I have understood, by reasons of good code style).

But, Groovy++ provides many semantic extensions such as very complex types inference system, traits, extension methods, functional programming library, etc.

Because of this, I think what Groovy++ isn't just "subset of Groovy" as you have told.

uhbif19
  • 3,139
  • 3
  • 26
  • 48
  • If Groovy++ is a Groovy dialect because auf the fact that it has no extra syntax, than how is Java realated to Groovy? Is Java a Groovy dailect as well? I think a lanaguage cannot be only reduced to the syntax. You have to consider the sematics as well and the sematic makes the difference between Groovy and Groovy++. – Peter Nov 03 '11 at 15:28