[dmd-internals] Throwing Errors

Walter Bright walter at digitalmars.com
Mon Mar 12 17:35:39 PDT 2012



On 3/12/2012 2:39 PM, Sean Kelly wrote:
> On Mar 12, 2012, at 2:30 PM, Walter Bright wrote:
>> On 3/12/2012 12:34 PM, Sean Kelly wrote:
>>> I'm on the fence about whether attempting cleanup when an Error is thrown is desired behavior.  If there is no cleanup, why allow Errors to be caught at all?  We may as well simply call abort() at the point they're thrown.
>>>
>> So that an informative message can be printed, the backup engaged, attempt to shut down gracefully, log the failure details to a file, etc.
> … none of which may work if scope(exit) calls weren't run when the stack was unwound, since acquired mutexes would still be locked, etc.  I'd feel a lot less safe with having effectively done a longjmp across code that normally assumes finalization than with whatever the cause of the assertion did in the first place.
>

It's understood it may not work.


More information about the dmd-internals mailing list