BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Mark Mahieu Creates CICE Closure Prototype

| by Charles Humble Follow 166 Followers on Jan 22, 2008. Estimated reading time: 1 minute |
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.

Rate this Article

Adoption Stage
Style

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

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT