Platinum Partner
java,closures

Java Closures Death Match

With the recent surge in Java closures blogs, I thought I would do a roundup on some recent hot topics. Probably the most important development is that we now have prototypes for the three major closures proposals. That means it's time for the steel cage death match!

Ok, I guess that's not really necessary. But we do have the tools now to do a comparison on syntax and functionality of these proposals:

  • BGGA (spec) - Neal Gafter is driving the most thorough proposal
  • FCM (spec) - Stephen Colebourne and Stefan Schulz have a method-oriented approach
  • CICE (spec) - Josh Bloch is championing a simpler approach to simplifying anonymous inner class syntax

java.net has been running a poll on closures and the results are kind of interesting. At the moment, BGGA is in the lead, but neck and neck with NO closures. FCM is making a respectable showing (given it's lower profile) and CICE has only a tiny percentage. I suspect this poll probably isn't too useful since the vast majority of those voting have not taken an in-depth look at the proposals and really understood the details and differences. Peter Ahé (former tech lead for javac), requested a boycott of the poll in principle.

Another area of focus lately has been on the closure syntax, which of course is something that will look foreign to any Java developer unfamiliar with closures. Here are some recent syntax articles:

I can't say I'm too excited about the pointer syntax idea. I find FCM's syntax to be a little nicer in general although I don't like the placement and notation of return types. I initially disliked BGGA's syntax, but I've seen enough of it now that it doesn't bother me. I think the final blog there is an interesting one and it would be convenient to use the same syntax in Groovy and Java.

If you're interesting in tracking articles on closures and Java 7 in particular, check out my Java 7 link blog (RSS).

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}