Proposal: Exceptions and @nogc

Dukc via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 5 23:46:31 PDT 2017


On Monday, 3 April 2017 at 23:33:10 UTC, Jack Stouffer wrote:
> Example: company wants to use their custom GC (like 
> sociomantic) with Phobos. They want to do this even for 
> exceptions because they believe that things will be faster if 
> they're able to completely control when any memory is freed. 
> Your solution does not help these people use Phobos because the 
> compiler will be inserting calls to free in places they don't 
> want, which will slow down their program.

I think that because of that, the following should be possible:

Exception store;
catch(Exception e)
{   //does not call the destructor
     store = new Exception(e.move);
     //still no destructor called because e is null
}

In case of preallocated exceptions, thats ugly to do everywhere. 
But it could be argued that so is relying on EH speed on the 
first place! Form follows the function. Still, I agree that's a 
problem.




More information about the Digitalmars-d mailing list