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

Neal Gafter neal at gafter.com
Mon Mar 30 09:11:45 PDT 2009


On Mon, Mar 30, 2009 at 8:07 AM, Tom Hawtin <Thomas.Hawtin at sun.com> wrote:
> 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.

Parser implementations tend to handle the issue by following the
grammar in the JLS, which is not ambiguous.  See the discussion
following your quote.



More information about the coin-dev mailing list