www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - safe by default and old code

reply Kirill <kirill.saidov mail.com> writes:
I've heard that there are plans to make D ` safe by default`.

Then the question that pops into my head is what will happen to 
all the code that was written before it and once it is 
implemented?

Will it require a rewrite?

How should the code be written from now on to avoid this?
Aug 05 2021
next sibling parent Dylan Graham <dylan.graham2000 gmail.com> writes:
On Friday, 6 August 2021 at 00:30:36 UTC, Kirill wrote:
 I've heard that there are plans to make D ` safe by default`.
The question pops up every few months, but I don't think anything has been decided.
 Then the question that pops into my head is what will happen to 
 all the code that was written before it and once it is 
 implemented?

 Will it require a rewrite?
I assume that there will be a deprecation phase before that is implemented so that codebases and dependencies have ample time to adjust to upcoming changes, without breaking them in the meanwhile
 How should the code be written from now on to avoid this?
Declaring ` safe:` at the top of your module sort of does the same thing. Try to use safe D where ever you can, and mark other things as ` trusted` and ` system` as appropriate. more experienced D users, feel free to correct me.
Aug 05 2021
prev sibling next sibling parent reply Paul Backus <snarwin gmail.com> writes:
On Friday, 6 August 2021 at 00:30:36 UTC, Kirill wrote:
 I've heard that there are plans to make D ` safe by default`.
The plan to make ` safe` the default was [DIP 1028][1]. Ultimately, it was rejected due to lack of consensus regarding how `extern(C)` functions should be handled. Since then, no new plan has been made, and it is probably safe to assume that ` system` will remain the default. [1]: https://github.com/dlang/DIPs/blob/master/DIPs/rejected/DIP1028.md
Aug 05 2021
parent Kirill <kirill.saidov mail.com> writes:
On Friday, 6 August 2021 at 03:47:03 UTC, Paul Backus wrote:
 On Friday, 6 August 2021 at 00:30:36 UTC, Kirill wrote:
 I've heard that there are plans to make D ` safe by default`.
The plan to make ` safe` the default was [DIP 1028][1]. Ultimately, it was rejected due to lack of consensus regarding how `extern(C)` functions should be handled. Since then, no new plan has been made, and it is probably safe to assume that ` system` will remain the default. [1]: https://github.com/dlang/DIPs/blob/master/DIPs/rejected/DIP1028.md
Thank you for the update.
Aug 05 2021
prev sibling parent Patrick Schluter <Patrick.Schluter bbox.fr> writes:
On Friday, 6 August 2021 at 00:30:36 UTC, Kirill wrote:
 I've heard that there are plans to make D ` safe by default`.

 Then the question that pops into my head is what will happen to 
 all the code that was written before it and once it is 
 implemented?

 Will it require a rewrite?

 How should the code be written from now on to avoid this?
Even if it is implemented one day, there will be a command line option in the compiler to disable it exactly for the reason you brought up.
Aug 05 2021