C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Exception compatibility with aliens

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Wed, 18 Jan 2023 11:24:29 -0500
On Wed, Jan 18, 2023 at 10:36 AM Frederick Virchanza Gotham via
Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> On Wed, Jan 18, 2023 at 3:07 PM Jason McKesson wrote:
> >
> > Also, this proposal seems to be missing the biggest issue with
> > cross-language exception handling: the fact that you can't throw
> > exceptions across languages. The only thing you *can* do is catch
> > exceptions on the source language end, convert them into some data
> > packet, and throw a different exception on the destination language
> > side.
>
>
> Yes this is what I had in mind. Behind the scenes, the C++ compiler
> would catch the Python exception and then throw something that C++ can
> deal with "such as std::aliens::python::exception".

So you want C++ *compilers* to incorporate Python code? Like, really?

Proposals for the C++ language should empower C++ users in general.
Not just the small subset who routinely interact with Python
specifically. They certainly should not require compilers to talk to
specific languages.

If you have a language proposal for automated, general conversion of
some kind of error object obtained from a general source into throwing
an exception, that's one thing (though again, `std::expected` seems to
fit the bill for the most part). But any idea that C++ *compilers*
would interact directly with any particular interpreted language? No.

Received on 2023-01-18 16:24:49