Proposal: Exceptions and @nogc

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 4 01:46:13 PDT 2017


On 4/3/2017 11:59 PM, Jonathan M Davis via Digitalmars-d wrote:
> No, it's not a problem that's specific to exceptions, but the string for an
> exception message is pretty critical and is going to have a significant
> impact on the ability to use @nogc with exceptions. Just being able to have
> the exception itself be allocated and managed safely via @nogc is definitely
> a step up, but if we don't have a reasonable way to manage the exception's
> message in @nogc code, then in many cases, we have a serious problem with
> how informative exceptions are. And if you really don't care about the
> exception message saying anything more than you can put in a string literal,
> you can always pre-allocate the excetion and avoid the whole @nogc problem
> that way without any of the proposed language changes. As such, I'm inclined
> to think that the benefits of the proposed changes are minimal if they don't
> fix the problem with the exception's message being GC-allocated.

https://github.com/dlang/druntime/blob/master/src/object.d#L1701



More information about the Digitalmars-d mailing list