Groovy JSR: A New Era for Java?
fastdecade writes "Groovy, the open-source scripting language, has been submitted for a Java Specification Request (JSR). And not without strong support from venerable J2EE practitioner/author, Richard Monson-Haefel, who labels this "the beginning of a new era in the Java platform". Groovy can use Java objects easily and compiles to JVM byte code, but it is nonetheless a scripting language at heart and a great companion for the more heavyweight Java programming language. Most JSRs concern new APIs, and this is the first JSR for an alternative language. Imagine a common platform of standardised languages talking to each other ... this looms as a big threat to .Net and a rejuvenation of the Java platform."
java can only succeed if the runtime is part of consumer OSs? right now, I think it is not... . probably got this one wrong, dunno...
I hope I didn't brain my damage.
Having a glue language to tie together Java objects is definitely cool, as is having the scripting language compile down to bytecode for easy deployment.
.Net because its set of tools has grown a little, but Groovy itself seems to be more a threat to Perl and Python and other scripting languages rather than anything Microsoft is doing (except for WSH, but is anyone really using that?) Having a scripting language that can reach directly into Java bytecode without having to invoke a separate VM is a great improvement over the current methods of running external Java programs.
I guess in some obscene way, one could infer that Java is somehow a threat to
Frankly, to me, it doesn't matter which 'platform' succeeds. Both frameworks exist on many platforms, so whichever wins, we all benefit.
I have been pwned because my
It sounds to me like anywhere you think you want this, you would be better off with actual Python.
...and a rejuvenation of the Java platform.
I think people who make statements like this aren't really aware of how widespread the usage of Java is in enterprise and multi-tiered systems.
Java is not just applets.
It's simple: I demand prosecution for torture.
Hopefully the name will get changed prior to getting this into the JSE platform. Does it bother anyone else to imagine having to talk about something called Groovy in a professional environment? The Groovy site is chock full of cuteness about making this or that more or less "groovy". I don't mind it personally but it's not helpful when you expect non-technical types to have faith in stuff.
Anyhow, the JSE platform could use an implicit scripting language. I can see the technical merit in this. A Groovy based shell (with exceptions, an abstract file system, all the JDBC goodness integrated, etc.) that works right everywhere would be a nice bit of progress.
Maw! Fire up the karma burner!
The cool thing about blocks, that hardly anybody seems to mention, is that you can factor out "transactional" code. For instance, code like this:
..
.. do something time-consuming..
...
t = open_thing()
try:
frob(t)
fozzle(t)
glorp(t)
finally:
close_thing(t)
In ruby you can factor out the try/finally and just do:
with_thing { |t|
frozzle(t)... etc
}
and you don't have to clutter the code with the same construct, over and over. This is why ruby is so popular with the XP crowd, you can factor out common stuff into ONE PLACE which you can't do with java or python.
More examples:
File.open('/foo/bar') { |f|
}
YOu know the file is closed at the end of the block.
busy_cursor {
}
never worry about forgetting to put the cursor back at the end of the operation, or if the operation throws an exception.
run_time = stopwatch {
}
stopwatch() is a function that simply times the code in the block.
Wonderful feature that improves readability and allows you to factor out common setup/teardown code.
would you mind explaining in what way
hash.each_pair do |key,value|
is not "special" syntax, but
foreach ($array_name as $key_name => $value_name)
is?
Groovy seems to offer nothing that you don't already get in Python, and Python has implementations available based on C (C Python), Java/JVM (Jython), and C#/CLR (IronPython).
The only thing Groovy does offer is that it is Java/JVM-specific at this point--there are no implementations based on anything other than the Java/JVM runtime. That may be a good thing for Sun--tying people even more to Sun's platform--but it sure isn't good for anybody else.