[dmd-internals] Throwing Errors

Jesse Phillips jesse.k.phillips at gmail.com
Thu Mar 15 17:09:52 PDT 2012


I'm a little confused, Errors come from program bugs, they shouldn't
be recovered, but you are saying that cleanup can still be had through
catch/throw? You mean that the cleanup code used for making Exception
safe code would need to be duplicated in the try/catch of Errors too?

You say Exceptions should be used for recovery, but don't provide what
you should use when you aren't trying to recover but want to cleanup
on program bugs (I don't see cleanup as recovery). And yes I would
consider an escaping exception to usually indicate a program bug too.

On Thu, Mar 15, 2012 at 3:25 PM, Walter Bright <walter at digitalmars.com> wrote:

> If any of that cleanup code actually needs to run on program bug shutdown,
> it still can be done with catch/throw. The other stuff assumes normal
> operation and is not needed to be run for shutdown/logging.


More information about the dmd-internals mailing list