Why hide a trusted function as safe?

simendsjo via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jul 26 04:38:29 PDT 2015


Is there a reason why you would hide the fact that a function is 
trusted rather than safe? Technically it doesn't matter, right? 
To me, it seems like this would give wrong assumptions to the 
caller.

The reason I ask is because I found the following in 
std.concurrency:

     @property Tid thisTid() @safe
     {
         // TODO: remove when concurrency is safe
         auto trus = delegate() @trusted
         {
             if( thisInfo.ident != Tid.init )
                 return thisInfo.ident;
             thisInfo.ident = Tid( new MessageBox );
             return thisInfo.ident;
         };

         return trus();
     }



More information about the Digitalmars-d-learn mailing list