PROPOSAL: open and close brace optional for single statement try, catch, finally, method declaration

Neal Gafter neal at
Wed Apr 1 07:39:57 PDT 2009

On Wed, Apr 1, 2009 at 7:12 AM, Glenn A. Marshall
<glenn.a.marshall at> wrote:
> But you seem to be saying something else - that, conceptually, from a code
> perspective this proposal isn't clear.  Can you elaborate please?  I believe
> the code snippet you originally provided is handled.

The usual technique for handling the dangling else problem is to
rewrite the grammar so that it is no longer ambiguous.  In other
words, programs that under an ambiguous grammar would have more than
one interpretation will, under the rewritten grammar, get a single
interpretation.  I gave an example that is ambiguous in your proposal.
 Instead of suggesting that it would be handled in one way or another,
you said that it would be illegal.  That's not the same solution
normally applied to the dangling-else problem.  A more precise
specification in the form of a grammar would help us better understand
what you have in mind.

However, I believe the question is moot because I don't believe this
proposal has any chance of being considered.  Besides lacking a
specification, it doesn't address a common pain point for Java
programmers or add to the expressive power of the language.

More information about the coin-dev mailing list