why scope(success)?
Chris Miller
chris at dprogramming.com
Wed May 10 13:49:57 PDT 2006
On Wed, 10 May 2006 00:39:30 -0400, Regan Heath <regan at netwin.co.nz> wrote:
> You're right. For some reason I got it in my head that scope(success)
> happened when the function itself returned, as opposed to the current
> scope closing.
>
> So, what about in this case:
>
> int foobar( ..etc ..)
> {
> if (a) scope(success) a.foo();
> //A: immediately after if
> }
> //B: at function return
>
> when does a.foo() get executed? at A or B? I get the impression it's A.
>
> Regan
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();
- Chris
More information about the Digitalmars-d
mailing list