[OT] - C++ exceptions are becoming more and more problematic
Alexandru Ermicioi
alexandru.ermicioi at gmail.com
Thu Feb 24 01:29:55 UTC 2022
On Thursday, 24 February 2022 at 01:04:47 UTC, meta wrote:
>> 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.
>
> I agree, but it is getting better! Also the idea is to not
> mimic them, but to learn from them instead and move forward..
Sure, D should be taking best parts from other languages and
improve them. It's just, that having no exceptions, and no
alternative as good as them or better, might not be the best
idea. I personally don't care how exceptions are implemented
under the hood as long as they do their job well enough for
staple source code (non-perf chunks of the code). Performance
sensitive code should just use more performant alternatives to
exceptions.
Imho, nicest option would be to provide ability to choose what
implementation of exception mechanism a function uses. Then for
function expected to fail often, you could choose to propagate
the exception through as part of return argument, or any other
mechanism that is performing better at cost of non-exception path.
More information about the Digitalmars-d
mailing list