Is @safe still a work-in-progress?

Mike Franklin slavo5150 at yahoo.com
Fri Aug 17 21:11:20 UTC 2018


On Friday, 17 August 2018 at 16:00:26 UTC, 12345swordy wrote:
> On Friday, 17 August 2018 at 15:27:22 UTC, Mike Franklin wrote:
>> I actually started writing a DIP for this about a year ago, 
>> but I need to pick my battles.
>>
>> Mike
>
> Is it on github?
>
> Alex

No,but here are some notes I found in my files.

@safe by default
Before Transition

     Write a program that parses D code and explicitly adds 
@system if no function is not decorated with any safety attribute
     Add a transitional -explicit-safety compiler switch that 
emits a warning if a safety attribute is not explicitly specified.
     Update all dlang repositories and maybe others with explicit 
attributes using aforementioned program.
         Turn on -explicit-safety for all CIs so any new PRs so 
explicit safety is added to all new functions.
     Add transitional @system-by-default compiler switch for 
backward compatibility
         This will be especially useful to keep our CIs running 
with legacy code
         This will also be useful for programs with dub 
dependencies that need to continue running
     Add - at system-main compiler switch for backward compatibility
     Add - at safe-main and - at safe-by-default compiler switch for 
forward-looking D projects
     Update all of D's tutorials, examples, etc… with explicit 
safety attributes.

Transition

     Add changelog entry warning that @safe-by-default is coming 
and how they can use the aforementioned tools eliminate disruption
         Run this change log for 1 year (4 releases)?

After Transition

     Remove @safe attributes in D's example code.
     Remove @safe attributes from phobos/druntime/dmd etc..
     Turn off -explicit-safety for those libraries that have 
updated their code.
     Deprecate @safe-main and @safe-by-default compiler switch 
through the normal deprecation process.
     -explicit-safety, @system-main and @system-by-default remain 
for an indeterminate amount of time. They should eventually be 
deprecated, but only after they have outlived their usefulness.

Difficulties

     The difficulty will be with printed material (books, etc…) 
that will become out-of-date. Recommendation is to add 
information to their published errata, or create a new edition.

Mike


More information about the Digitalmars-d mailing list