RFC: reference counted Throwable

via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 20 09:28:25 PDT 2014


On Saturday, 20 September 2014 at 15:28:10 UTC, ponce wrote:
> 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.

Ah, now I see, you just want a wrapper that contains a Throwable.
I thought you wanted to throw _any_ value types, like in C++.


More information about the Digitalmars-d mailing list