On Thu, 08 Jan 2009 06:25:11 +0300, Brad Roberts <[email protected]> wrote:

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

The only possible example I can think of is a case inside switch:

switch (i)
{
   case 42:
   {

   }
}

Reply via email to