Proposal: Exceptions and @nogc

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 3 14:00:53 PDT 2017


On 4/3/2017 6:43 AM, Jack Stouffer wrote:
> Sounds like using compiler magic for changing the behavior of existing syntax
> rather than fixing the actual problem that std.allocators is trying to solve:
> unifying disparate allocation strategies/needs across libraries.

I don't see a point to having disparate allocation strategies for exception 
objects. In any case, the compiler will insert calls to specific functions to 
allocate/free exception objects. Those functions will be in druntime, but anyone 
can override them with their own implementation.


> Do we really want to break a bunch of code and add another special case for this
> one specific problem, thereby making an already complicated language even more
> complicated?

This particular solution will break very little existing code, and solves a 
fairly difficult problem.


> Also, half of the nogc purists aren't going to be using druntime anyway.

The idea of this proposal is to make a nogc program much more achievable. 
Currently, in order to not link with the GC, you can't use exceptions (or at 
least not in a memory safe manner). A solution without memory safety is not 
acceptable.


More information about the Digitalmars-d mailing list