Catching C++ std::exception in D

Iain Buclaw via Digitalmars-d digitalmars-d at puremagic.com
Thu Nov 12 01:09:25 PST 2015


On 12 November 2015 at 09:59, Jacob Carlborg via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:

> On 2015-11-12 07:50, Walter Bright wrote:
>
> 3. Be able to catch in D code an std::exception* or a C++ class derived
>> from that.
>>
>
> In would be nice if we were able to catch Objective-C exceptions as well
> (it uses the same exception handling as C++). They have their own tree of
> exception classes which do not inherit from std::exception. We don't need
> to support this right away but it would be nice to avoid any artificial
> limitations preventing this.
>
> --
> /Jacob Carlborg
>


C++ can catch exceptions thrown in D and ObjC using `catch(...)`, and
there's no technical limitation on why we can't do the same from a D `catch
{ }`.  But I don't think Walter wants C++-style catch-all support in D, and
currently our version of catch-all is lowered to `catch(Throwable)` which
does not have the same semantic meaning.

--
Regards
Iain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20151112/af80323c/attachment.html>


More information about the Digitalmars-d mailing list