Possibility of adopting Rust's Error Handling?
Alexandru Ermicioi
alexandru.ermicioi at gmail.com
Fri Apr 1 09:41:09 UTC 2022
On Thursday, 31 March 2022 at 22:00:17 UTC, H. S. Teoh wrote:
>
> AIUI, D used to have its own implementation of exceptions that
> was more performant than libunwind. Sadly, that got junked in
> the name of C++ compatibility, so now we're stuck with
> libunwind along with all of its downfalls.
>
> In theory, if we're willing to accept ABI changes, we could
> replace the current libunwind-based implementation with a
> register-based status to indicate when an exception is thrown,
> and emit explicit branches for that. Then it would be the
> equivalent of error-code-based handling, except without the
> code uglification and the type constraints.
>
>
> T
Just wondering, would it be possible to use lubunwind, only in
extern c++ declarations?
I.e. we'd have own exception handling in D code, and C++
compliant exceptions in extern C++ one?
This would mean that when d code interacts with c++ it will get
translated into respective mechanism, from c++ if it is from c++
code called by D code, and into c++ one if it is from extern c++
d code that is called by c++ code.
Alexandru
More information about the Digitalmars-d
mailing list