Java 7: The Closure Debate
Closures are code blocks; think of them as function literals that can be assigned to a variable and passed as a parameter to a function. Another name for closures that I have heard use is functors. Ruby and Groovy have closures and both of these languages run on the Java Platform. So why do we need closures in the Java language? Another good question is, but aren’t anonymous inner classes just like closures? The man the is trying to best answer these questions is Neal Gafter. Neal is rallying the Java community to include closures at the language level in next release of Java.
The issue of closures in Java 7 is a hotly debated topic and as software engineers and Java developers we will hear more on the subject for the foreseeable future. To get everybody up to date on closures here are some articles on the subject.
1. Closure – The computer science definition of a closure via Wikipedia.
2. Closure – The definition of a closure code block according to Martin Fowler.
3. Java Closure Poll – As of this written 70% are for closures.
4. Closures for the Java Programming Language – Closures for Java specification page.
5. A Definition of Closures – An detailed article by Neal Gafter.
6. Neal Gafter JavaPolis 2006 Interview – A 9 minute video interview of Neal Gafter.
7. Advanced Topics In Programming Languages: Closures For Java – A two hour talk by Neal Gafter on closures in Java in Google Video.
8. Considering Closures for Java – An interview with Neal Gafter on Artima.
9. Inner Classes or Closures – A detailed blog post on Artima about closures and inner classes.
10. When is a closure not a closure? – More on the subject.
11. Crossing borders: Closures – Bruce Tate has written a tutorial on closures using the Ruby programming language.
I’ll be updating this post with new resources as they are made available.