Proposal: Exceptions and @nogc
David Nadlinger via Digitalmars-d
digitalmars-d at puremagic.com
Mon Apr 3 14:38:16 PDT 2017
On Monday, 3 April 2017 at 21:00:53 UTC, Walter Bright wrote:
> 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.
You could use an exception instance allocated in TLS (which is,
in fact, what Weka does in large parts of the code). This should
be perfectly memory safe, although there are of course
implications for exception chaining. (By default, you'll still
get an allocation for the associated TraceInfo, but you can
disable that.)
Of course, this is not to say that a nicer/more general solution
wouldn't be appreciated.
— David
More information about the Digitalmars-d
mailing list