Tuesday, August 22, 2006

Java 7 with Closures

Closures for Java "I'm co-author of a draft proposal for adding closures and local functions to the Java programming language for the Dolphin (JDK 7) release. An abbreviated version of its current state is reproduced below. It was carefully designed to interoperate with the current idiom of one-method interfaces."

Based on the example, "int(int) plus2b = (int x) : x+2;" you know it must be Java when you have the type in there three times. Something like Groovy's closures or Ruby's seems better syntactically. There's also some other ideas to add such as currying and iterators.
Post a Comment