Discussion Thread: DIP 1028--Make @safe the Default--Final Review

Adam D. Ruppe destructionator at gmail.com
Fri Mar 27 15:40:00 UTC 2020


On Friday, 27 March 2020 at 09:07:01 UTC, Walter Bright wrote:
> BTW, I have an upcoming DIP that changes the default attributes 
> for delegate parameter types to match the function they appear 
> in.

You'd probably have to make an exception there for @trusted... if 
a @trusted function takes a @trusted delegate it would get 
silently ugly.

OR perhaps

@trusted void foo(@trusted void delegate) { }


foo( () { /* do unsafe thing */} ); // fails to compile unless 
the body infers to @safe, it will never assume a @system literal 
is trusted

foo( () @trusted { /* do unsafe thing */}); // OK, you 
specifically said trusted so it works


More information about the Digitalmars-d mailing list