PROPOSAL: open and close brace optional for single statement try, catch, finally, method declaration
Tom Hawtin
Thomas.Hawtin at Sun.COM
Mon Mar 30 08:07:04 PDT 2009
Neal Gafter wrote:
> On Mon, Mar 30, 2009 at 6:25 AM, Tom Hawtin <Thomas.Hawtin at sun.com> wrote:
>> This is similar to the dangling-else ambiguity.
>> http://en.wikipedia.org/wiki/Dangling_else
>
> Perhaps, but the Java grammar does not have a dangling-else ambiguity.
I think that is inappropriately pedantic. JLS 3rd Ed, 14.5/p368: 'the if
statement of the Java programming language suffers from the so-called
"dangling else problme,".' I don't know how parser implementations tend
to handle the issue.
> The grammar was carefully written to be unambiguous. This proposal
> would make the grammar ambiguous.
The proposal is insufficiently detailed to tell whether the grammar
would become ambiguous. A more detailed version could use the same hack
to remove the ambiguity (although multiple usage of the hack grows the
grammar non-linearly).
Tom Hawtin
More information about the coin-dev
mailing list