11

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)?

Carl
  • 7,538
  • 1
  • 40
  • 64
Roman
  • 64,384
  • 92
  • 238
  • 332
  • 3
    I'm confused too. But because at most one of those proposals will be implemented in Java7 I personally just wait until it is decided and study the 'winner'... (http://stackoverflow.com/questions/116865/whats-the-current-state-of-closures-in-java) – Andreas Dolk Jan 22 '10 at 12:38
  • @Andread_D: but as I know at least one implementation is already exists. I'm not sure that this is the implementation which will be included to Java 7 but I've seen a link to download it. – Roman Jan 22 '10 at 12:41
  • Three proposals? There is at least 50. – Tom Hawtin - tackline Jan 22 '10 at 12:46
  • 1
    I'm talking about BGGA, CICE, and FCM which are the most frequently mentioned actually. – Roman Jan 22 '10 at 12:49
  • FCM is the best one to study, IMO. The current most likely proposal is not based on any of the others, but it looks a lot like FCM. – jsight Jan 22 '10 at 13:23

2 Answers2

6

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
  • 10,751
  • 3
  • 30
  • 46
  • Thanks, I've already seen this stuff but I wasn't sure that it's actual. – Roman Jan 23 '10 at 19:18
  • If possible, could you perhaps share a short-ish code example of each proposal and links to the proposals too? – Esko Jan 26 '10 at 07:07
  • Ahh... what could have been... Those proposals look a lot better than what we're being given in Java 8! They'd solve the problems I outline here: http://stackoverflow.com/a/20177092/1151521 And "Function Types"! Oh, what I wouldn't give for them! – Aleksandr Dubinsky Dec 09 '13 at 21:53
2

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.

AlBlue
  • 23,254
  • 14
  • 71
  • 91
Fabian Steeg
  • 44,988
  • 7
  • 85
  • 112