Groovy JSR: A New Era for Java? 100
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."
wasn't it that... (Score:2, Insightful)
Imagine.... (Score:5, Informative)
You mean like Parrot?
Imagine... a single Virtual machine spec... (Score:2)
a Sun Virtual Machine ( SVM ) that has libs for java and can be targeted well by other langs
start with the JVM fix the Java memory model
(JSR 133 [jcp.org], which has been active for nearly three years see article on fixing it and links at bottom located at [ibm.com] )
let ADA and fortran target it well
(i.e. think about take floating point IEEE754 seriously but get it out there and tune later)
really not that hard look at Programming Languages for the Java Virtual Machine [tu-berlin.de]
Start with something you know we
I mean, really (Score:2)
Re:I mean, really (Score:2)
bah (Score:2, Interesting)
Re:bah (Score:4, Informative)
Re:bah (Score:2)
C# and the CLR will gain ground because they really do have considerable more technical merit than Java. They will also gain ground because there is a complete open source implementation available (there aren't for Java).
Isn't this more a threat to Perl than .Net? (Score:5, Insightful)
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.
Let Me Get This Straight (Score:5, Insightful)
It sounds to me like anywhere you think you want this, you would be better off with actual Python.
Re:Let Me Get This Straight (Score:5, Interesting)
This is like Python,
Except it's actually elegant, based on Smalltalk, not whatever the heck Python is inspired by.
And Python reference counting stinks, I just spent weeks debugging a C extension that keeps killing a Python-based server.
I use Python, but I sure don't think there's anything "great" about it, at least not enough to explain why it seems *every* language discussion includes somebody who thinks Python is god's gift to computer science.
Python came along at a time when people where starting to use Perl for bigger projects and realizing that Perl is really BAD for big projects. Momentum took over from there.
Re:Let Me Get This Straight (Score:3, Insightful)
I don't see anything "elegant" about yet another scripting language built on top of a runtime designed for a simple statically typed language (Java).
And Python reference counting stinks,
True. It also makes the C-Python interpreter slower than a garbage collected version. It is somewhat disconcerting that this misfeature of C-Python still exists after so many years. In fact, the C-Python implementation
Re:Let Me Get This Straight (Score:4, Interesting)
I like to point out that running Groovy in a JVM means: you want to script java code.
I also do not really see the difference between running a PVM or a JVM (python virtual machine versus java virtual machine).
But: I know that Java Byte Code is Hot Spot compiled to machine code. A groovy script running in a JVM scripting Java classes or classes of other languages (like SmallTalk or Lisp or Prolog or Eiffel or Ada or: Python) is java byte code, isnt it? So it is compiled to machine code during runtime.
Goovy is an excellent language. And in case it gains momentum like one has written here, there is no doubt that people will port it to Parrot and the Python VM just like Python is ported to the JVM.
angel'o'sphere
Re:Let Me Get This Straight (Score:1)
Well, unlike Sun's Java runtime (which is the only one that counts), the Python runtime is open source. Furthermore, the Python runtime takes a fraction of the amount of memory of the Java runtime.
Goovy is an excellent language. And in case it gains momentum like one has written here, there is no doubt that people will port it to Parrot and the Python VM just like Python is ported
Re:Let Me Get This Straight (Score:2)
First you doubt groovy is worth it and you argue Python is better somehow.
Now you start arguing with open source
Finally you try to distract the reader even further by saying this: The Python port to the JVM was a fluke--it only works so well because someone really smart spent a lot of time on making it happen.
First I like to point out: there have been two Python ports to the JVM which got merged later to the Jython we have in our day
Re:Let Me Get This Straight (Score:1)
Sure, I have. It's just another run-of-the-mill scripting language. The only significant distinction is that, so far, it seems particularly tied to the JVM.
Second I like to point out: Writing a Python compiler for the JVM is as trivial as writing a Python compiler to the PVM. Funny is: You start in a pure Python environment and use the Python compiler which is wr
Re:Let Me Get This Straight (Score:2)
The biggest difference is the license and the patents (the PVM is free and open, the JVM isn't)
I did not ask about THOSE differents. Besides the fact that it is from a lawers point of view simply wrong. The JVM specification is "open". Everybody is free to wrie a JVM which is free software. I guess the "free software community" did not found it worth while to do so. Or how do you explain that there are about 20 open/free JVM implementations and none of them is "finished" while there a
Re:Let Me Get This Straight (Score:1)
It is the stated goal of Groovy to be a dynamic and scripting language for Java (see here [codehaus.org]). That is, its design is driven by the needs of Java developers and adapted closely to the Java environment.
Maybe it will be ported to other platforms, but Groovy will then be as foreign on those other platforms as somet
Re:Let Me Get This Straight (Score:5, Insightful)
What platforms is Java NOT ported to?
I know it is available for Windows, Linux, FreeBSD, AIX, HP-UX, Solaris, AS/400, Handhelds (Palm, Handspring, SaveJe, etc), and direct hardware (PTCU and TINI)... What's missing?
Re:Let Me Get This Straight (Score:3, Informative)
http://www.apple.com/macosx/features/java/ [apple.com]
What platforms is Java NOT ported to? (Score:5, Funny)
Atari 800. It's very frustrating.
Re:What platforms is Java NOT ported to? (Score:2)
>
> Atari 800. It's very frustrating.
Next thing you're going to mention the TI-55?
Re:What platforms is Java NOT ported to? (Score:2)
Re:What platforms is Java NOT ported to? (Score:2)
It is available for the Atari-ST [atari-forum.com] (though not full implementation).
There is also an Atari800 emulator written in Java [atari800.info], and another one for Zaurus [comcast.net]...
But maybe I am searching wrong, because the only Python-related atari800 links I found were for the same emulator type of things?
Thoughts on the Atari 800 (Score:3, Interesting)
I've become rather fascinated of late with the Atari 800, and with what "could have been," had it been upgraded properly.
The Atari 800 was the brainchild of Jay Miner (who later created the Amiga), and you can see the Atari 800 really _was_ the precursor to the Amiga, with its use of coprocessors for video, sound, & memory management, in addition to the CPU. The only thing that hobbled the Atari 800 was its expandability, or, lack thereof. Unlike the Apple
Re:Let Me Get This Straight (Score:5, Informative)
Re:Let Me Get This Straight (Score:5, Insightful)
Unless you want access to any of the miriad of Java libraries that are available, such as JDBC drivers, XML parsers, SOAP tools and 3rd party components you may want to use unless you prefer to use something like Jython.
I have to work with other bits of code and systems all the time, and thats the main headache with using Python that I run into.
Python might be king of quick hacks, but for a large-scale project where bits of scripting code might be appropriate, this sounds like an excelent option where you would NOT be better off with python.
Re:Let Me Get This Straight (Score:4, Informative)
Semi-check [python.org], built-in [python.org], check [interview-machine.com], and check [vex.net] (including a lot of real winners, particularly including multiple [wxpython.org] cross-platform [daa.com.au] GUIs [riverbankcomputing.co.uk]).
(The semi-check is because I'm not 100% certain the python modules match the JDBC completely.)
The only advantage Java offers is when it has an actual library that you can't get in Python (or likely anywhere else); capability for capability the languages and libraries are pretty close to the same. I mean, we have "Web Application Servers" for Python (like Zope), but maybe you absolutely need some Java thing for some other reason. There's no one language that meets all needs. But there's no reason Python can't be used in very large scale projects successfully, as evidenced by the fact that it has been so used.
Personally, I'd much rather use Python for the larger scale projects since for a variety of reasons I think it scales better then Java; Java projects IMHO survive because they get a lot more resources thrown at them, not because the language does very much to hold large projects together. But that's just my opinion.
(Oh, and Jython [jython.org], though I know it's been mentioned elsewhere.)
Re:Let Me Get This Straight (Score:2, Interesting)
No, I don't.
Python might be king of quick hacks, but for a large-scale project where bits of scripting code might be appropriate, this sounds like an excelent option where you would NOT be better off with python.
There are plenty of scripting languages for that. Jython and JavaScript have both C and JVM-based implementations. Beanshell is small and integrates particularly well with Java. I really don't see why we need G
Re:Let Me Get This Straight (Score:1)
Java does have a bigger footprint than Python, but that is unrelated to whether it uses garbage collection or reference counting. IMO, Python is a nicer language than Java, but the use of reference counting in Python actually makes it both slower and more bloated than a garbage collected implementation of Python would be.
Re:Let Me Get This Straight (Score:1)
Also, I'm not sure what do you mean by bigger footprint when you refer to a language. GC interpreters/VMs may have a bigger footprint, but at the same time the footprint of the running software is smaller than reference counting because of the lack of reference counters.
*blink* hey this is COOL (Score:5, Interesting)
But this groovy thing looks like a really nice smalltalk-esque language that hooks right into Java, enough to satisfy both sides of my brain.
This is cool and I can benefit from this *right now* in my work. Forget Parrot or Perl 666 (heh).
How come I never heard of this? And why doesn't jpackage [jpackage.org] have it?
Re:*blink* hey this is COOL (Score:2)
Re:*blink* hey this is COOL (Score:2)
I've been a Python programmer as long as I've been a Java programmer (since 1996), so I've followed Jython with great interest. The problem with Jython is that it's implementation is ssssllllooooooooowww. As in 2-3 ma
Warning, Obligatory Jython reference ahead (Score:1, Interesting)
I hate scripting languages, except Bash shell.
Why...because when I program I want an object oriented language. Notice the period at the end of that sentance. If I didn't want the Benefits of Java, I would not program in Java.
Yes, I would love it if the Runtime environments for PERL, Python, Java, Ruby, and a slew of other Lagnugaes could be combined so I could have one and only one virtual machine required.
What I really want is to not have to wrap any Java program I wri
Re:Warning, Obligatory Jython reference ahead (Score:1)
And I don't really hate Scripting languages. Some of my best friends code in Perl.
I guess with Groovy we can also use the time honored
Javaish? Funny, doesn't look like Javaish.
Re:Warning, Obligatory Jython reference ahead (Score:5, Informative)
Actually, as of JDK 1.5, System.getenv() [sun.com] is undeprecated (is that even a word? :). I'm sure that was a first in the java libraries though :)
Re:Warning, Obligatory Jython reference ahead (Score:2)
Re:Warning, Obligatory Jython reference ahead (Score:2)
That's not as far of as you think:
You can create servlets using Groovy [codehaus.org].
Re:Warning, Obligatory Jython reference ahead (Score:1)
Re:Warning, Obligatory Jython reference ahead (Score:2)
probably you should read a bit more about how to use the CLASSPATH.
a) Bash exercise
CLASSPATH=Blah:blue:Blink
b) simle Java start
java -Dcustom.config.dir=/home/adam/blah com.younglogic.app.Executable
Note: as the CLASSPATH is set, tehre is no need to use -classpath
As you dont like -D (I agree here) why dont you put the infoirmatin you pass here into a properties file and use Object.getResource("file.props"); to load it?
c) complex Java sample:
java -Dcustom.config.dir=/home/adam/blah -classpath=some/mor
Re:Warning, Obligatory Jython reference ahead (Score:2)
I know about the $CLASSPATH thing, just like to make it explicit.
I find whene ever I start scripting, the scope of the application increases and I wish I were using a language that was good for large projects. Some people are comfortable using Perl in the Large, but I am not. Maybe I was just warped too early. Blame my CS instructors. I always do.
I've done the pr
rejuvenation? (Score:5, Insightful)
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.
Re:rejuvenation? (Score:2, Funny)
it's about time cool programmers stepped up on the java scene.
Re:rejuvenation? (Score:2)
LOL rejuvenate != repair
Rejuvenation: To restore to youthful vigor or appearance; make young again.
Java is 9 years old, getting to be a senior citizen in the world of programming languages. Do you think it's possible to be a successful 60-year old person and still enjoy being restored to youth? Of course, they are not incompatible concepts.
Not everyone around he
JCP naming thunk? (Score:4, Insightful)
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.
Re:JCP naming thunk? (Score:2)
As opposed to Java, which is so well named itself? Or perhaps Sun? As in - "Sun's Java will help our business." Try that in 95 and see what you get from PHB.
Re:JCP naming thunk? (Score:2, Funny)
I guess you could call it Javascript.
Blocks! (Score:3, Interesting)
which outputs 1 2 3 and 4 on a line. the cool thing about this style of coding is it makes it's very easy to extend functionality like this to hashes such as:
notice how that code was able to do that much, without having to use "special" syntax like perl and php (foreach blocks, etc).
i definitely will have to give this language a shot.
Re:Blocks! (Score:1, Insightful)
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 d
Re:Blocks! (Score:3, Informative)
new StopWatch(2000) { public void run() {
frozzle(blah);
}}.start();
where StopWatch is a class that executes the run method for up to 2000 ms. Granted some syntactic sugar would be nice.
I agree with yuour assertion that blocks are extrememly helpful. I was first introduced to them in Smalltalk.
Joe
Re:Blocks! (Score:4, Insightful)
hash.each_pair do |key,value|
is not "special" syntax, but
foreach ($array_name as $key_name => $value_name)
is?
Re:Blocks! (Score:2)
the code in that block makes a new thread. the do ... end code is a "block" (think of it as a dynamically created function) that's passed as a parameter to the thread constructor. that's not special syntax,
Re:Blocks! (Score:2)
python lambda-functions (nameless functions, passed as callbacks)
it's the equivalent, then, of using STL algorithms like
[NIT-PICK:]
i would say that calling it a "block" is confusing, as that term is already used to refer to things in {} in most l
Re:Blocks! (Score:2)
I think the term block referring to [:args| statements] predates, or at least is contemporary with, the introduction of { } to describe blocks.
In a way, you can see {..} as a handicapped version of [..], in that they are not first class and do not take arguments. To think: C was *that* close to having a proper lambda construct.
Re:Blocks! (Score:2)
foreach in perl deals with arrays not hashes. To deal with a hash you get the list of keys from the hash as an array and iterate through them. You can deal with arrays using a for loop if you want to, but foreach just reduces the amount of code you have to write.
Re:Blocks! (Score:3, Informative)
Re:Blocks! (Score:2)
Scripting with .NET (Score:4, Informative)
This leads to problems where you've got an environment where you'll be running lots of dynamic script code -- your process pretty much leaks memory. The only solution is to run your scripted code off in another AppDomain, but then you've got the considerable overhead of doing cross-AppDomain calls (serialization/deserialization, both ways) and you're restricted to types that can be passed across the AppDomain barrier.
Even then, you've got to be extremely careful because if you pass back a type that was defined in the assembly generated by the script, your primary AppDomain will silently load the assembly itself to deal with the type (and keep it open forever -- the thing we wanted to avoid!).
I understand there are considerable performance gains in
I'm not all that familiar with this aspect of Java -- does Java suffer from the same problem of not being able to unload code/types from memory?
Re:Scripting with .NET (Score:5, Informative)
The only limitation is that the class must not be on the classpath (for security reason). This is also how you can have the same class but with different version on the same VM.
See : http://java.sun.com/j2se/1.4.2/docs/api/java/lang
Re:Scripting with .NET (Score:2)
To be able to garbage collect Classes, you have to load them using a new ClassLoader, and then be damned sure that all references to the classes and the ClassLoader are de
Re:Scripting with .NET (Score:2)
If you're running a MUD, let's say written in
Instead you would more then likely have those scripts compiled and objects "loaded" on the fly using ICodeCompiler using the GenerateInMemory property set to true. You can then recompile this on the fly at any point.
Your problem lies in script B
Re:Scripting with .NET (Score:2)
That's the approach I was planning on using, however that just creates a more-or-less standard assembly in memory. There's no way to unload the assembly. Recompiling doesn't unload the old assembly, just returns you a reference to the new assembly via the CompiledAssembly property. The example
Re:Scripting with .NET (Score:1)
Mono implements it already.
Re:Scripting with .NET (Score:2)
Mono implements it already.
Awesome. That's exactly what I need; and Mono implementing it is even better since that's my development platform.
what's the point? (Score:3, Insightful)
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.
Re:what's the point? (Score:2)
Groovy seems to offer nothing that you don't already get in Python
If like extend that just a little bit then I come to this: every language seems to offer nothing more than any other language allready has.
Ooops. And now? Am I wrong? All programming languages can be used to do more or less everything else.
However there are two things which make a HUGHE difference:
a) programming pradigm
its a difference wether you code
Great but why a JSR (Score:4, Informative)
Beanshell (Lightweight Java)
http://www.beanshell.org/
JavaScript (Rhino)
http://www.mozilla.org/rhino/
Python (Jython)
http://www.jython.org/
Ryby (JRuby)
http://jruby.sourceforge.net/
has all been available for several years without being made a JSR.
What qualifies groovy to become a JSR instead of them ? Isn't choice good.
IBM has open sourced a framework called BSF
http://jakarta.apache.org/bsf/
that allows for integrating scripting languages into java. I could see why THAT would be promoted to a JSR -- not a specific scripting language.
As the name suggests it looks like groovy is just a couple of guys who have been playing around with tossing "groovy" language features into their homegrown scripting langugage. Cool, interesting but why make it part of the big package ?
Re:Great but why a JSR (Score:2)
Wouldn't it be nice to have a community supported alternative to Java? Or even a language integrated tightly
muliple languages in the JVM (Score:1)
What's crappy about JSF? (Score:1)
Re:What's crappy about JSF? - Nothing (Score:2)
uhhh, no (Score:1)
except that
Re:uhhh, no (Score:2)
...and...except that Java already has, like, a bizillion languages [slashdot.org] under it that can "talk" together.
The list referenced earlier in the thread lists some, but there are "bizillions" (what is that? Like two zillions?) more. Google for them.
Re:uhhh, no (Score:2)
zillions... (Score:2)