Should scope(exit) be valid outside of a scope?

Graham Fawcett fawcett at uwindsor.ca
Wed May 12 07:33:53 PDT 2010


On Tue, 11 May 2010 22:18:29 +0200, Don wrote:

> void foo(bool x)
> {
>     if (x)
>        scope(exit) writeln("exiting");
>     writeln("body");
> }

Doesn't this do what you want, without changing the language?

void foo(bool x) {
    scope(exit) {	
      if (x) writeln("exiting");
    }
    // ...
}

Best,
Graham


More information about the Digitalmars-d mailing list