Should scope(exit) be valid outside of a scope?
Adam Ruppe
destructionator at gmail.com
Tue May 11 13:38:15 PDT 2010
On Tue, May 11, 2010 at 10:18:29PM +0200, Don wrote:
> Currently the scope(exit) doesn't get executed at all (it's bugzilla
> 1894). But I suspect that any such use of scope guards is a bug.
> Can we just make it illegal?
I was pondering named unit tests and wanted to use this:
{
if(getenv("VERBOSE_TESTS"))
scope(exit) writefln("Test successful");
}
But it didn't work. The alternative, scope(exit) if(blah) write; should
accomplish the same task though.
I'd be good with it being an error, to make it obvious which method is
preferred.
More information about the Digitalmars-d
mailing list