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

Steven Schveighoffer schveiguy at gmail.com
Fri Jan 3 15:29:38 UTC 2020


On 1/3/20 6:06 AM, Walter Bright wrote:
> On 1/2/2020 10:31 PM, Mathias Lang wrote:
>> On paper, this sounds like a great idea. Make '@safe' the default so 
>> people have to opt out of memory safety rather than opt-in. However, 
>> we have extensive experience with those changes (and how they are 
>> handled), and I am not, as it stands, in favor of it.
> 
> Modules can be labeled as @system by beginning them with:
> 
>     @system:

This does not work for member functions (also a valid criticism of the 
suggestion to mark a module @safe)

It also is almost always not what you want, as this then forces 
templates to be @system.

In other words, marking @safe: at the top makes sense, you can fix all 
the compiler errors that result.

Putting @system: at the top is not going to have the same effect, things 
that really are @safe will work when marked as @system. You want as 
LITTLE as possible to be marked @system, not a blanket marking.

This should not be a suggestion. Take the time to assess why a function 
is not working, and mark it @system only if it needs to be.

-Steve


More information about the Digitalmars-d mailing list