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

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Thu Feb 24 00:51:31 UTC 2022


On Thursday, 24 February 2022 at 00:19:44 UTC, meta wrote:
> Who will allocates that (the RC part)?
>
> I personally disagree with the idea of exceptions altogether..
>
>
> The answer is in solutions like in Zig/Go, errors, multiple 
> return values, if changing the way error handling works in D, 
> better make it good, for good!
>
> There is no reason to be stuck with exceptions..

There are reasons to be stuck with exceptions. Go is a no go, due 
to constant if else error checking it forces user to do. 
Exceptions perfectly represent exceptional cases that can be 
handled if caller wants to. Littering every method with tuples as 
return values and method calls with if checking is even worse 
than performance costs of how currently exceptions are 
implemented.

The point is, not all code is required to be performant, some of 
it, can use exceptions for code and logic readability at cost of 
performance downgrade.


More information about the Digitalmars-d mailing list