[OT] - C++ exceptions are becoming more and more problematic

IGotD- nise at nise.com
Thu Feb 24 11:22:15 UTC 2022


On Thursday, 24 February 2022 at 11:07:31 UTC, rikki cattermole 
wrote:
>
> My concern is that there will be situations which no one can 
> predict; exceptions are very hairy (after all, they can go up 
> the chain of functions not written in D).
>
> This is why I'm not suggesting that we should replace exception 
> handling in the general case. Only where the compiler can see 
> that it can be done (plus this can be improved over time).

I think that exceptions work kind of well in a code cleanness 
kind of way. The proposal from Herb Sutter looks like exceptions 
but it is return values under the hood.

D also has the ingenious scope guards (scope(exit) and such) 
which work very well with exceptions. It would be bad if this 
would be thrown away with a new error handling mechanism. 
Therefore I think return values should also have the exception 
syntax.


More information about the Digitalmars-d mailing list