http://wiki.dlang.org/DIP25

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 5 13:10:01 PST 2015


On 12/30/2014 4:14 AM, Steven Schveighoffer wrote:
> But I agree. The problem is, most times, you WANT to ensure your code is @safe
> pure nothrow (and now @nogc), even for template functions. That's a lot of
> baggage to put on each signature. I just helped someone recently who wanted to
> put @nogc on all the std.datetime code, and every signature had these 4
> attributes except a few. I tried to have him put a big @safe: pure: nothrow:
> @nogc: at the top, but the occasional exceptions made this impossible.

The way to do it is one of:

1. reorganize the code so the non-attributed ones come first

2. write the attributes as:

    @safe pure nothrow @nogc {
       ... functions ...
    }

    ... non attributed functions ...

    @safe pure nothrow @nogc {
       ... more functions ...
    }



More information about the Digitalmars-d mailing list