开发者

Are Groovy and Groovy++ two languages or one language?

开发者 https://www.devze.com 2023-04-02 01:30 出处:网络
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

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?


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).


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消