DIP 1008 Preliminary Review Round 1

MysticZach via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 5 08:29:31 PDT 2017


On Friday, 19 May 2017 at 15:45:28 UTC, Mike Parker wrote:
> DIP 1008 is titled "Exceptions and @nogc".
>
> https://github.com/dlang/DIPs/blob/master/DIPs/DIP1008.md

I would like the DIP to fully articulate the choice that it's 
facing, that special-casing the language for `throw new` comes 
with some downsides, but that the alternative is to force 
programmers to rewrite all their exceptions if they want to mark 
their functions `@nogc`. This requires an analysis of the 
similarities and differences between `throw new` and other uses 
of `new`. My personal impression is that exceptions do indeed 
fall into a distinct category, where they are easier to contain 
and shorter-lived than ordinary `new` memory. But the downside is 
that the language loses a little elegance by having another 
special case, and there might be corner cases where the special 
case is undesirable. I can only assume that at minimum, should 
this DIP be _rejected_, it should be replaced by some official 
documentation and methods on how to properly throw exceptions in 
`@nogc` code.


More information about the Digitalmars-d mailing list