Errors in TDPL

biozic dransic at free.fr
Tue Jun 22 07:18:08 PDT 2010


Le 22/06/10 15:53, Walter Bright a écrit :
> biozic wrote:
>> Le 22/06/10 10:54, Walter Bright a écrit :
>>> Andrei Alexandrescu wrote:
>>>> On 06/21/2010 08:47 PM, Jonathan M Davis wrote:
>>>>> On page 82 of TDPL, it's talking about try/catch/finally statements,
>>>>> and it
>>>>> says that "all controlled statement must be block statements; that is
>>>>> they
>>>>> must be enclosed with braces." However, dmd does not seem to require
>>>>> that
>>>>> try/catch/finally blocks have braces, which is what I would expect
>>>>> that
>>>>> sentence to mean. C++ has that restriction for reasons that I don't
>>>>> understand, but as far as I can tell, D does not - certainly dmd
>>>>> doesn't
>>>>> appear to require it. Is the statement correct but refers to
>>>>> something else,
>>>>> or is it in error?
>>>>>
>>>>> - Jonathan M Davis
>>>>
>>>> That's a surprise to me. Walter, is that intentional?
>>>
>>> They do not require braces, they just require that the controlling
>>> statement not be a single ;. In the grammar, this is a ScopeStatement,
>>> which is a NonEmptyStatement or a BlockStatement.
>>>
>>>
>>> http://www.digitalmars.com/d/2.0/statement.html#ScopeStatement
>>
>> Not always: http://d.puremagic.com/issues/show_bug.cgi?id=4024
>
> Bugs in the compiler aren't errors in TDPL!

I totally agree. I was saying that the requirement for braces was not 
always intentional :S


More information about the Digitalmars-d mailing list