DIP 1029---Add throw as Function Attribute---Community Review Round 1

Walter Bright newshound2 at digitalmars.com
Thu Jan 16 08:04:35 UTC 2020

On 1/15/2020 7:26 AM, Arine wrote:
> I'm completely blown away, you don't even know 
> that @safe passes through to the next scope?

My mistake. What actually happens is here:

     sc2.stc &= STC.safeGroup;


where the storage class passed from the outer scope to the struct/class scope is 
zeroed out except for @safe/@trusted/@system.

So @safe "flows through" to the struct scope, while nothrow, pure, @nogc, etc., 
do not.

For functions, the line is:

   sc2.stc &= ~(STC.auto_ | STC.scope_ | STC.static_ | STC.extern_ | 
STC.abstract_ | STC.deprecated_ | STC.override_ |
                STC.TYPECTOR | STC.final_ | STC.tls | STC.gshared | STC.ref_ | 
STC.return_ | STC.property |
                STC.nothrow_ | STC.pure_ | STC.safe | STC.trusted | STC.system);


Interestingly, @nogc does flow through here.

So, the flow through behavior depends on the attribute. My mistake I did not 
check first before posting.

More information about the Digitalmars-d mailing list