DRAFT PROPOSAL: Implement BGGA Closures for Java
neal at gafter.com
Mon Feb 25 22:58:19 PST 2008
DRAFT PROPOSAL: Implement Closures for
neal at gafter.com
Implement Lambda Expressions, Function Types, and Control Abstraction
I propose to produce a feature-complete prototype of the Java bytecode
compler (javac) features for the Closures specification appearing at
http://www.javac.info/closures-v05.html, suitable for integration into the
openjdk javac compiler as part of the reference implementation of a future
platform specification. The specification includes the following major
- closure literals (sometimes called lambda expressions)
- function types
- control invocation statements
This includes support for the following component features
- restricted and unrestricted forms
- the closure conversion
- exception type parameters
- union types
- definite assignment
- the type Unreachable (to be renamed Nothing)
- loop abstractions
- access to non-final variables within a closure
The prototype shall be complete in providing support for all features of the
specification, including those described above, as well as supporting
"nonlocal" return, break, and continue in unrestricted contexts. The Clear
Need A discussion of the needs satisfied by this proposal appears in a draft
JSR proposal at http://www.javac.info/consensus-closures-jsr.html. In
summary, the draft specification supports the development and use of APIs
that significantly improve the use of concurrency for multicore systems, and
enables the development of APIs that significantly reduce boilerplate for
some common programming patterns.
A community vote at java.net <http://www.java.net/pub/pq/196> identified
this approach to closures as most preferred among those who voted.
Development Guidelines Devlopment of the prototype shall take place as an
openjdk project to be created within the openjdk compiler
in accordance with the prevailing community governance procedures for such
development. The prototype shall be contributed under the Sun Contributor
Agreement. Dependence on Sun and other resources
While the development of the specification is outside the scope of this
project, it is likely that the specification will evolve in response to
community feedback. For example (as discussed in the draft JSR
specification) I expect to add support for constructing a closure by
reference to an existing Java method ("method reference"). Any such changes
in the specification shall be followed by inclusion of those changes in the
scope of the project.
Development of the prototype shall take place independently of Sun
Microsystems. I expect involvement of Sun Microsystems employees -
particularly Alexander Buckley, the editor of the Java Language
Specification, and Maurizio Cimadamore, a specialist in type systems, in
refining the specification and providing feedback about specification
changes that will be necessary to integrate the work into the Java Language
Specification and to integrate it with other language changes that might be
under consideration. Such specification refinements shall be reflected in
the prototype. In addition, I expect continued collaboration with other
authors on the draft specification, including specifically Gilad Bracha,
James Gosling, and Peter von der Ahe.
Additional work may be desireable in the virtual machine or core libraries
in support of this work. For example, it would be useful for the virtual
machine to provide support for proper tail recursion and to generate
function type interfaces on demand. It would be helpful to extend the
reflection libraries to support the new features. Such additional
specification and implementation work is outside the scope of this project.
Project Plan and Milestones Development shall proceed as follows:
- 2008-04-30: An initial prototype shall be published as an openjdk
patch, providing support for most of the features of the specification with
unit tests and regression tests.
- 2008-05-30: An extension of the com.sun.source, javax.lang.model,
and javadoc APIs shall be included in a revision of the prototype.
- 2008-06-30: An update to the prototype shall be published that
provides support for nonlocal return, break, and continue, and any other
remaining features from the initial specification.
- 2008-07-18: Any specification changes preceding 2008-06-01 shall be
reflected in a revision of the prototype.
- 2008-08-03: Final, feature-complete submission of the Closures
prototype shall be delivered at this time.
In addition to these milestones, I expect to provide regular prototype
updates in response to bug reports from users of the prototype.
While not formally part of the project, I expect to recommend JVM, library,
and other platform changes that are likely to improve performance,
usability, or integration with the platform or other language changes likely
to be included at the same time as closures.
Copyright This proposal, in its entirety, is hereby contributed under the
terms of the Sun Contributor Agreement.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the challenge-discuss