DIP60: @nogc attribute

monarch_dodra via Digitalmars-d digitalmars-d at puremagic.com
Sat Apr 19 10:51:37 PDT 2014


On Saturday, 19 April 2014 at 17:41:58 UTC, Walter Bright wrote:
> The first step is to identify the parts of Phobos that 
> unnecessarily use the GC. @nogc will help a lot with this.

Unless I missed it, I think we still haven't answered the issue 
with throwing exceptions. I'm in particular interested in asserts 
and Errors.

Will "assert" be usable in @nogc code? Because if not, then 
basically *none* of phobos will be @nogc.

Also, I don't think statically pre-allocating the error is an 
acceptable workaround.

EG:

assert(arr.length, "arr is empty.");

vs

version (assert)
{
     static Error e = new Error("arr is empty.");
     if (!arr.length) throw e;
}


More information about the Digitalmars-d mailing list