« How to use Ant 1.6 with IDEA 4 | Main | What would a Jython JSR do? »

Scripting frees

So why Groovy? Why not Jython or JRuby? Why not one of the dozens of other programming languages that are designed to run on the Java Virtual Machine? It's my opinion, and I believe the opinion of those who support this JSR, that Groovy is the best choice because it was built from the ground up for the Java Platform and uses syntax that is familiar to Java developers, while leveraging some of best features that Python, Ruby and Smalltalk have to offer. Jython and JRuby are excellent examples of how existing languages can be ported to the Java platform, but they are, after all, ports. They use syntax that is not designed with Java developers in mind and they are founded on a completely different set of code libraries. Groovy is designed for Java developers and its foundation is the standard APIs of the Java Platform. - Richard Monson-Haefel

Yes, it's built from the ground up from a Java perspective but when you use it aside JRuby or Jython that doesn't make much difference - it's just another language, just another port, and not one that feels like Java. Not the way Javascript or C# does.

Anyway, at this stage, the Groovy community need to justify their approach to anyone - they're just getting on with it and if they want a JSR I'm for that. Groovy's legacy will be that it was language that changed how we think about the platform.

I still like the idea of a Jython JSR - but for the wrong reasons - I think Jython is the best language available to the Java developer and damn if it doesn't get enough hype. But yes, Jython is not a hotbed of activity and it needs to get to 2.3 where the dynamic and functional idioms available are truly mature - if you think closures are excellent, wait until you use generators.

Really, what we need is for Sun (and the J2EE vendors) to get behind the idea of dynamic languages running on the JVM for enterprise work as well as admin and housekeeping work. Maybe there's someone in there that wants to port Self? Or maybe someone wants to port C#? Maybe someone wants to build end-to-end J2EE apps in JRuby or Groovy? Who knows.

update: James said in reply to my comment about using Groovy coimpared to other languages, "I take your point if you treat them as scripting languages in isolation - though the big difference is how you mix a scripting language and Java code". His point is well made.


March 26, 2004 06:45 PM

Comments

gabriele
(March 27, 2004 12:16 AM #)

if you think generators are powerful why not use groovy's iterators? or LUA's coroutines?
I you think closures are excellent, why do you want just python's restricted lambda over ruby's real (i.e. just like lisp) lexical closures?

I believe the python community is reacting badly to groovy.
We need to look at it for what it does better than us not for what he does not have. Python is not perfect, yet.

James Strachan
(March 27, 2004 04:46 AM #)

I totally agree with your sentiments that scripting languages are great for Java / J2EE and hope Groovy helps in its own little way to bring that to more mainstream attention. Just a couple of further points...

(quote)
Yes, it's built from the ground up from a Java perspective but when you use it aside JRuby or Jython that doesn't make much difference - it's just another language, just another port, and not one that feels like Java.
(quote)

I take your point if you treat them as scripting languages in isolation - though the big difference is how you mix a scripting language and Java code.

The Java code sees the Groovy code as POJOs and vice versa and both sets of code are using the same APIs - no wrappers or adapters - plus the Groovy code can fully overload methods using the JVMs type overloading system (e.g. I can overload the write(String) method while preserving the semantics of write(Object) for example). Or I can expose a typesafe method in a Groovy script for Java guys to use.

OK now a question for you :) The Python language is standardized through the PDP and Jython is a port/impl of it. JSR 223 is an API to bind any scripting language to the JVM & web container. So what would a Jython JSR do?

Yuri Schimke
(March 27, 2004 06:41 AM #)

I was reading about the Common Language Specification, a set of rules for languages in the .Net platform. I believe this means CLS languages should be able to extend or use components written in another CLS language.

Java doesn't need a CLS. The standards war was a non-event on the JVM, the standard is Java 1.4 (currently). Thats the big deal, a "first class" JVM language must be able to extend Java components and provide components to be used by Java code etc.

Some people seem to want a JSR for integrating scripting languages into Java. Something like BSF possibly, well thats just too limiting, Who wants to explore the power of scripting languages through some clunky abstraction. Having your scripting code run inside an App Server or as a plugin to an IDE should be just a matter of implementing the interface.

Yuri Schimke
(March 27, 2004 06:48 AM #)

BTW Generators do look nice. Although I think its fair to say the cases where they make a big difference over closure iterators are fairly uncommon cases.

As I understand its basically an unbounded loop with a continuation. Or is that too limited a description?

Bill de hra
(March 27, 2004 12:44 PM #)

[[[
if you think generators are powerful why not use groovy's iterators? or LUA's coroutines?
I you think closures are excellent, why do you want just python's restricted lambda over ruby's real (i.e. just like lisp) lexical closures?
]]]

My answer to this is that I can use Python in a production setting without raising eyebrows. It's nicely expedient. Plus I find Python user-friendly and it gives me just enough expressive power without either gilding the lily or linguistic navelgazing. I believe some of matz's comments about Ruby wrt Lisp indicate a simlar sensiblity. Perhaps I'd just as well use some other language, but that's an effort in salesmanship. As for Ruby, it's not different enough from Python for me to make want to switch - I tend look at Ruby/Python the way many people look at Java/C#. I won't deny that's a questionable attitude to have...

[[[
I believe the python community is reacting badly to groovy.
]]]

Not that badly I hope :) As a Python/Jython user, I want Groovy to continue to be a success. I see the mindshare around Groovy as a major breakthrough. And an opportunity for other languages ;-)

Robert Sayre
(April 1, 2004 11:52 PM #)

What does Groovy do that Rhino doesn't?

Trackback Pings

TrackBack URL for this entry:
http://www.dehora.net/mt/mt-tb.cgi/1202