views:

252

answers:

2

I'm reading about closures which are going to appear in Java 7.

And I'm a bit confused because from one hand there are lots of nice articles which describe new java closures. But from the other hand there were 3 different specs and some of the articles are simply outdated because describe not the latest proposal.

So, if anyone tracks the progress of java closures from the begining then please describe in general terms very shortly all 3 proposals and their current state.

One more thing I wonder about closures is if there only one development line exists or different versions are being developed (like, closures from Sun, from Google, from Apache etc)?

+6  A: 

If I recall correctly

CICE was simply a syntactical sugar to more easily create anonymous classes in a way that looked like a closure.

BGGA was a very powerful proposal that allowed not only true closures, but also syntax to define structures that looked like new syntax elements (aka using(Closable){block}).

FCM was an additional proposal that tried to be a compromise between the two, with a full closure proposal, but with better syntax and without some of the more controversial features of BGGA.

The current proposal can be found at http://www.javac.info/closures-v06a.html and http://www.javac.info/closures-v06b.html, where part A is the simple full cosures, and part B is some of the more powerful features taken from BGGA.

ILMTitan
Thanks, I've already seen this stuff but I wasn't sure that it's actual.
Roman
If possible, could you perhaps share a short-ish code example of each proposal and links to the proposals too?
Esko
+2  A: 

From what I understand, Project Lambda, the planned changes to add lambdas (some of which are closures, and some closures are lambdas) to the Java language, will be a mix of the older proposals. The currently most recent information available on the proposal is the 0.1 draft of the specification. To stay informed on the progress you can follow Mark Reinhold's updates.

Fabian Steeg