Exceptions in @nogc code

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 4 02:45:14 PDT 2017


Thank you for posting this.

Figuring all this out thoroughly will take some time, so this is just first 
impressions.

1. we already have some of the benefits of the proposal because D has transitive 
immutability

2. I'm looking for a solution where exceptions don't rely on the GC to the point 
where the GC code doesn't even need to be linked in. This proposal appears to 
maintain a dependence on the GC.

3. It requires annotation of catch declarations with one of "", "scope", or 
"owned". I expect this would be a significant problem

4. Since the catch block is not type checked against the corresponding throw, 
the object will have to have noted in it who owns it.

5. The normal case is:

     throw new Exception("message");
     ...
     catch (Exception e) {
          writeln(e.msg);
     }

which would ideally work without involving the GC at all.

6. reducing the amount of GC garbage created is good, but does not solve the 
problem of "I don't want to use D because of the GC".

This proposal looks promising for making a better garbage collected language, 
but people want a language with an optional GC.


More information about the Digitalmars-d mailing list