BT
x Your opinion matters! Please fill in the InfoQ Survey about your reading habits!

Mark Mahieu Creates CICE Closure Prototype

by Charles Humble on Jan 22, 2008 |
One of the hottest topics in Java in recent years has been around adding full closure support to the Java language. Given the complexity that closures could introduce however, it is difficult to judge their full impact without being able to experiment with prototypes for the various proposals.

Now, joining Neal Gafter's BGGA proposal prototype, Mark Mahieu has begun putting together a prototype implementation of the CICE/ARM proposal written by Bob Lee, Doug Lea, and Josh Bloch. Concise Instance Creation Expressions (CICE) simply provide a more compact syntax for instantiating instances of an inner class with a single abstract method such as Runnable, Callable, or Comparator. Automatic Resource Management (ARM) blocks support one of the main use cases for closures; the scoping of resource use within a block such that when you exit the lexical scope of the block you automatically call the close method on the resource.

Mahieu's initial implementations are limited in scope. For CICE, just expressions, public local variables and implicitly final local variables are implemented; public locals and type inference are not. The ARM block implementation supports only the do() { } form of ARM block and relies on java.io.Closeable as a starting point. As noted by Mahieu and in the ARM specification itself, using Closeable is problematic since many existing types - java.sql.Connection, Statement, ResultSet and so on - could not be made to implement it in view of the fact that they throw other unchecked exceptions.

The prototype is already helping to drive out some details in the proposals with a newer build of the ARM implementation changing the default semantics of the do() { } form for checked exceptions.

With Stephen Colebourne working on a prototype for FCM we should be able to start getting much more of a feel for which aspects of the proposals work or don't over the next year.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT