Why exceptions for error handling is so important

Tobias Müller via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 12 09:31:34 PST 2015


Walter Bright <newshound2 at digitalmars.com> wrote:
> On 1/11/2015 11:09 PM, Tobias Müller wrote:
>> - Error codes are automatically ignored
>> - Exceptions are automatically propagated
>> 
>> IMO both are not ideal and lead to sloppy programming.
>> Ignoring errors is of course worse than aborting where you could have
>> handled the error.
>> 
>> Rust-style "packed" errors are nice because you are forced to think about
>> the correct handling.
> 
> 
> I don't think this is an answer to my point.

I thought that your question was a rhetorical one and I agree to a certain
degree.
You can still have automatic cleanup though. Rust has RAII.

The point is that I think that trading some prettyness for explicitness is
a good thing in that case.

But then again I also like checked exceptions (java) that seem to be
disliked by most. It a similar tradeoff.


More information about the Digitalmars-d mailing list