Tuesday Dec 16, 2008

There's been a lot said about closures both in favor and against the last couple of years.  The debate has raged on for what feels like an eternity.  But the semi-official announcement at Devoxxx recently that closures won't be making it into java7 seems to have put everyone back on their heels a bit.  I, for one, am relieved at the announcement.  Others are not so thrilled and have gone so far as to declare that Java is dead for their lack.  Personally, every major proposal out there made my eyes bleed.  There were so many gymnastics being proposed to deal with typing and generics and backward compatibility and the like that most of those proposals just made a mangle of the language.  I did see one idea that I like (my thoughts on that here) but there's little chance it'll get any serious traction.

I've used closures in both my fan work and my groovy work and I've enjoyed using them.  But the syntax employed is much simpler than what the main proposals had offered.  As nice as closures are, inner classes have served me well enough so far with very little heartburn.  Until Sun is ready to break with older versions of Java, I'm just not sure how well closures will work the current language and VM constraints.

What I was happiest too see was Mark Reinhold's jigsaw project.  A small, modular, independently updatable runtime would be fantastic.  I know many are upset at the lack of any major language changes being promised in java7 but I'd rather see what we have now work better.  Let's not destroy the language trying to shoehorn in things that just aren't working out.

Comments:

If people want to play with closures, there's JRuby, Groovy, Clojure, JScheme, Jython, Scala, etc. - all runnning on a JVM near you. Horses for courses.

Posted by Kevin Hutchinson on December 16, 2008 at 05:02 PM EST #

Right. Most of those with some level of integration with "native" Java classes should you need it. No rush (or even need) to get them into the Java language. I'd rather wait and get something usable...

Posted by Justin Lee on December 16, 2008 at 05:09 PM EST #

I wish you would use full URLs, not http://is.gd/, in your post. This isn't Twitter, and I don't want to have to click them to find out what they are.

Also, I'm very sad about this news.

Posted by Alex on December 16, 2008 at 05:17 PM EST #

There wasn't a real, tangible business case for the presented closure proposals. Those were just fancier ways of doing what is possible and relatively easy already, but the proposals also made the whole language more complicated than it needs to be.

I wish people had used that energy to make class reloading and the development cycle better.

Posted by Mikael Gueck on December 16, 2008 at 05:19 PM EST #

Alex, heh. Sorry, just force of habit. I learned to use such things in IRC and now I do it without much thought.

Posted by Justin Lee on December 16, 2008 at 05:21 PM EST #

I agree with you - time could have been spent on other things to improve the JVM rather than tacking on something ugly and overly complex. I hope that something for enabling low-level hooks for dynamic languages makes it into Java7 though - it's necessary to progress the JVM platform while keeping the Java language itself stable and clean.

Posted by pratik patel on December 16, 2008 at 10:16 PM EST #

The main problem is that Java's standard library is meant to be the library that all languages share. Without closures, this becomes less than ideal. But even if we ignore that, it would also be nice to see some JVM-level support for closures so that interoperability between JVM languages improves (not to mention performance and the like). The question is whether that will ever be done if Java doesn't get them.

Finally, I am also happy to see an effort to make the JDK more modular.

Posted by Ismael Juma on December 19, 2008 at 05:52 PM EST #

I don't bump into the need for closures like others seem to, so I don't mind if they make it or not. However, it does seem like development of Java itself is stagnant. Not sure that "dead" is the right terminology, but it does seem to be slipping into a "maintenance" type mode along with COBOL, C, etc.

I'm really starting to like Lisp, so I find Clojure an exciting tool. Running on the JVM, full library support, etc, make up for a few "not quite so Lispish" qualities that it has.

Posted by Brian Knoblauch on January 27, 2009 at 12:29 PM EST #

Brian, personally I'm starting to do more and more (well, once I get some OSS stuff out of the way) with fan (fandev.org). The syntax is close enough to Java's to grok most of it at first glance with some of the more "modern" features people seem hell bent on cramming in to Java.

Posted by Justin Lee on January 27, 2009 at 02:11 PM EST #

Post a Comment:
Comments are closed for this entry.