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

Steven Schveighoffer schveiguy at gmail.com
Fri Jan 3 18:41:48 UTC 2020

On 1/2/20 4:47 AM, Mike Parker wrote:
> This is the feedback thread for the first round of Community Review for 
> DIP 1028, "Make @safe the Default":
> https://github.com/dlang/DIPs/blob/1b705f8d4faa095d6d9e3a1b81d6cfa6d688554b/DIPs/DIP1028.md 
> All review-related feedback on and discussion of the DIP should occur in 
> this thread. The review period will end at 11:59 PM ET on January 16, or 
> when I make a post declaring it complete.
> At the end of Round 1, if further review is deemed necessary, the DIP 
> will be scheduled for another round of Community Review. Otherwise, it 
> will be queued for the Final Review and Formal Assessment.
> Anyone intending to post feedback in this thread is expected to be 
> familiar with the reviewer guidelines:
> https://github.com/dlang/DIPs/blob/master/docs/guidelines-reviewers.md
> *Please stay on topic!*
> Thanks in advance to all who participate.

Add to rationale:

The vast majority of non-template code written is @safe, but not marked 
as such. This means many projects cannot enable safe because their 
dependencies were not marked that way. This will correct that for all 
those dependencies.

e.g.: I made most of diet-ng safe so I could enable runtime diet 
templates (see PR here: 
https://github.com/rejectedsoftware/diet-ng/pull/70). Many of my changes 
were to enable @safe at runtime (most things were not marked safe 
because CTFE doesn't require @safe, and most of diet is using CTFE).

For the safety changes, most of what I did was simply to slap @safe: at 
the top, or inside types which were not templates. The one exception was 
object.opEquals, which I had to write a trusted wrapper for.

But in any case, it's a good rationale. I write non-template code ALL 
the time that is safe, but don't think to mark it. Same can be said 
about pure and nothrow.


More information about the Digitalmars-d mailing list