scope() statements and return

monarch_dodra via Digitalmars-d digitalmars-d at puremagic.com
Mon Oct 6 00:15:25 PDT 2014


On Monday, 6 October 2014 at 02:35:52 UTC, Shammah Chancellor 
wrote:
> It doesn't "catch" the error. Propigation should continue as 
> normal.

Right, it only "intercepts, cleanups, and rethrows". But the 
argument is that even that shouldn't happen, as you aren't sure 
the cleanup code is still relevant.

At least, I don't think it should be doing cleanup unless you go 
out of your way to say: "do this, *even* in case of errors".

I mean, your RAII has already failed anyways. Your memory has 
leaked, your ref counts are of the counter, your transactions are 
open, your file handles are open...

The only thing you should be doing is trying to die gracefully, 
and maybe salvage user data. Your program is in *ERROR*. Cleanup 
really shouldn't be the priority, especially if it can 
potentially add more corruption to your state.


More information about the Digitalmars-d mailing list