DMD 1.039 and 2.023 releases

Brad Roberts braddr at puremagic.com
Wed Jan 7 19:25:11 PST 2009


Jason House wrote:
> Walter Bright Wrote:
> 
>> redsea wrote:
>>> I'm happy to see Bugzilla 2518(scope(success) not execuate and RAII
>>> variable destructor is not called) has been fixed, Great !
>>>
>>> I have some questions when I check dstress suite and Bugzilla.
>>>
>>> In Bugzilla 99,  according to test case:
>>>
>>> int main(){ int i;  label: { scope(exit) i++; i=3; }
>>>
>>> if(i != 4){ assert(0); }
>>>
>>> return 0; }
>>>
>>> You said:
>>>
>>> The test case behaves as expected, because labels do not introduce a
>>> new scope when followed by { }.
>>>
>>>
>>> Then I check the online manual, and found:
>>>
>>> labels, scope(), pragma, condition compile(version/debug/static if)
>>> would be followed by NonScopeStatement.
>>>
>>> It is easy to understand scope/condition compile followed by a
>>> NonScopeStatement, but what is the meaning of  "Labeled Statements"
>>> + NonScopeStatement ?
>> A NonScopeStatement is a statement that, even if it has { }, does not 
>> introduce a new scope.
> 
> I don't think this answers their question. What curly braces mean
> after a label is clearly a design decision that you made when writing
> D. It seems that the choice is the opposite of what people expect.
> Can you explain why it should be NonScope?

Restating in the form of a question... When would you _ever_ want {...}
to not form a scope?

Later,
Brad


More information about the Digitalmars-d-announce mailing list