RFC: reference counted Throwable

ponce via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 20 08:28:10 PDT 2014


On Saturday, 20 September 2014 at 09:09:38 UTC, Marc Schütz wrote:
> On Saturday, 20 September 2014 at 09:05:15 UTC, ponce wrote:
>> On Friday, 19 September 2014 at 15:32:38 UTC, Andrei 
>> Alexandrescu wrote:
>>> Please chime in with thoughts.
>>>
>>
>> Coudln't we throw value types instead? (like in C++)
>
> But how would you chain them?

Owning pointer to next exception.

> And they have to implement Throwable's interface.
One of their member would. Speculative design:

struct ValueException
{
      Unique!ValueException next;
      Unique!Throwable content;
}

Language would change to throw structs and catch them (without
matching).
At the end of a catch bloc, its destructor is called.
This breaks polymorphic catch so it need sugar unfortunately.


More information about the Digitalmars-d mailing list