why scope(success)?

Ben Hinkle ben.hinkle at gmail.com
Wed May 10 17:35:25 PDT 2006


"Sean Kelly" <sean at f4.ca> wrote in message 
news:e3toih$26v4$1 at digitaldaemon.com...
> Chris Miller wrote:
>>
>> This gives me an idea, how about if there was scope(none) that is just 
>> like a regular block, but doesn't create a new scope. This would be for 
>> when you only need to group statements but have no interest in a new 
>> scope.
>>
>> void foo()
>> {
>>    if(a) scope(none) { stuff(); scope(success) bar(); }
>>    baz();
>> }
>>
>> bar() would execute after baz();
>
> It's a nasty hack, but:
>
> if(!a) goto blah;
> scope(success) a.foo();
> blah:
> ...

In Cx I was going to make that illegal - much like in C++ it's illegal to 
goto past an initializer or into a try block.

>
>
> Sean 





More information about the Digitalmars-d mailing list