2007-04-05

Closures in Java7?

Neal Gafter gave a talk in december which can be watched online about closures that might be introduced into Java 7. There is a website on that topic too, that contains the current specification draft of Java closures. Note that the presentation takes some time, but I think is worth watching.

As far as I understood it, closures are lambda expressions that are already bound to an environment (an enclosing block, parameters etc.). See Wikipedia for details.

What I am interested in is, whether they were inspired by the C# 3.0 specification or got on that road separately. Looking at both specifications, there is a syntax difference as far as I see; so what would be more important to me, is to have a cross-language syntax.

Both languages need that feature badly, much due to the absence of the RAII pattern from C++, thats no more possible because of the non-deterministic finalization of objects. Actually closures would expand possibilities beyond that. Love to see it coming!
Read more!