DIP 1028---Make @safe the Default---Community Review Round 1

Arine arine123445128843 at gmail.com
Thu Jan 2 17:27:22 UTC 2020

>  Fortunately, the solution is easy, although tedious: annotate 
> functions that aren't safe with @trusted or @system.

If you could annotate the module with @system to use the old 
behavior, this will ease the transition period. This is better 
than simply having a compiler flag that changes behavior, as you 
can see in the code that is using the old behavior. You can also 
disable it per module, not either on or off for everything.

     @system module std.stdio; // or similar

C# and Rust both are first class citizens for safety, they don't 
require hacks like using a lambda to declare a section of code as 
unsafe as you have to do in D.

@safe void foo() {

     // ...

     () @trusted {
         // ...
     } ();

     // ...

Since this DIP is so bare bones anyways, I'd be inclined to 
include these changes as part of this DIP.

More information about the Digitalmars-d mailing list