DIP 1008 Preliminary Review Round 1

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Fri May 26 04:50:40 PDT 2017


On 5/26/17 4:49 AM, Walter Bright wrote:
> On 5/25/2017 4:54 PM, Atila Neves wrote:
>> I think maybe the problem isn't with `throw` but with `catch`. What if
>> instead we make it so that:
>>
>> catch(scope T ex) { /*...*/; }
>>
>> Means:
>>
>> catch(scope T ex) { /*...*/; ex.__dtor; }
>
> The trouble comes in when one starts copying exception references
> around. Who then is responsible for destroying it?

This isn't the trouble. The trouble is that `new Exception` is not 
@nogc, and there isn't a way to fix all existing exception code easily.

But to answer your question, don't mark the exception scope in that 
case. The compiler should complain if you copy it outside the scope, no?

My $0.02: Either we are going to make `new Exception` be @nogc, or we 
are going to require people to type something different. IMO, I feel if 
we can create a library solution, and use dfix or similar tool to allow 
people to update their code, then we are in a much better place.

I need to review the DIP again, but last time I read it, there were some 
issues I saw. I will post those in a while.

-Steve


More information about the Digitalmars-d mailing list