"default" keyword as function attribute

tsbockman via Digitalmars-d digitalmars-d at puremagic.com
Sat Mar 19 15:06:49 PDT 2016


On Saturday, 19 March 2016 at 18:39:54 UTC, Jakob Ovrum wrote:
> As for the `default` approach, if we designed it to work with 
> explicit attributes, like so:
> ---
> @safe:
> void foo();
> void bar(T)(T t) default @nogc; // Infer pure, nothrow and 
> @safe but require @nogc
> ---
> Then `default` wouldn't have that problem.

This could be OK, but it should work for bulk annotations, as 
well:

@safe pure @nogc nothrow {
     void foo();

     default @nogc {
         void bar();
         void baz();
     }
}

It's rather awkward, but better than what we have now.


More information about the Digitalmars-d mailing list