Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Looking Past Lambda

Looking Past Lambda

This item in japanese


With Java 7 recently released, plans for Java8 are well underway. One of the key features pushed from Java7 to Java8 was Project Lambda, but not through lack of interest; mailings on the lambda-dev and the compilation group have continued apace.

There have been many changes to Project Lambda's reach over the years; the Lambda analysis InfoQ article largely covers initial proposals which have since changed. However, in a recent mail, Brian Goetz offers a look past the current iteration of the Lambda project towards a more functional future:

There is plenty of evidence in the ecosystem to support the hypothesis that, if given the tools to do so easily, object-oriented programmers are ready to embrace functional techniques (such as immutability) and work them into an object-oriented view of the world, and will write better, less error-prone code as a result. Simply put, we believe the best thing we can do for Java developers is to give them a gentle push towards a more functional style of programming. We're not going to turn Java into Haskell, nor even into Scala. But the direction is clear.

Lambda is the down-payment on this evolution, but it is far from the end of the story. The rest of the story isn't written yet, but preserving our options are a key aspect of how we evaluate the decisions we make here.

This is why I've been so dogged in my insistence that lambdas are not objects. I believe the "lambdas are just objects" position, while very comfortable and tempting, slams the door on a number of potentially useful directions for language evolution.

One of the reasons for removing the (erased) function types from earlier iterations of the proposal was because the current Java type erasure system renders these kind of function types less than useful:

The lambda strawman offered at devoxx had function types. I insisted we remove them, and this made me unpopular. But my objection to function types was not that I don't like function types -- I love function types -- but that function types fought badly with an existing aspect of the Java type system, erasure. Erased function types are the worst of both worlds. So we removed this from the design.

But I am unwilling to say "Java never will have function types" (though I recognize that Java may never have function types.) I believe that in order to get to function types, we have to first deal with erasure.

Whilst the current design has lambdas being used to provide single access method types (e.g. Runnable), it doesn't preclude the ability to add other functional types at a later stage.

Project Lambda, also known as JSR 335, is expected to be included in Java 8, to be released towards the end of 2012.

Rate this Article