This feels wrong

Shachar Shemesh via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 2 07:21:06 PST 2016


On 02/02/16 17:00, Steven Schveighoffer wrote:

> Just put try around the opApply specific parts you want to monitor.
> Don't guard the call to dg.
The call to dg is, obviously, part of a loop. That whole loop body is 
inside a try/catch.

What I ended up doing, instead, was to put a flag, and the call to dg 
is, effectively:

stuff...
{
	scope(failure) flags=true;
	dg();
}
more stuff...

and then, the catch:

catch(Exception ex) {
	if( flags )
		throw ex;
	
	other stuff...
}

My problem isn't so much the actual how to solve it, but rather that it 
is a potential pitfall when implementing that I don't think is documented.

Shachar


More information about the Digitalmars-d mailing list