@nogc

Manu via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 10 22:31:34 PDT 2014


On 11 July 2014 13:45, Walter Bright via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On 7/10/2014 7:31 PM, Manu via Digitalmars-d wrote:
>>
>> So, we allow assert() in nothrow functions, the argument is that
>> assert is non-recoverable, so it's distinct from user exceptions.
>>
>> I have this in my 'nothrow @nogc' function:
>>    assert(false, "Message " ~ details);
>>
>> It complains "Error: cannot use operator ~ in @nogc function"
>>
>> I think it should be allowed to invoke the GC for formatting error
>> messages inside of assert statements, just the same as assert() is
>> allowed inside of nothrow functions.
>>
>> Thoughts?
>>
>
> I've thought of allowing "throw new ...", and yours would be in addition to
> that, in @nogc functions, but was waiting to see how this would play out a
> bit first.

Well upon updating to 2.066b, the first thing I did was to spam @nogc
everywhere and see how that worked out, and realised that virtually
everywhere I tried was blocked by my assert statements.
So I think it's safe to say this needs to be addressed for @nogc to be useful.


More information about the Digitalmars-d mailing list