Thread overview
@safe by default and old code
Aug 06, 2021
Kirill
Aug 06, 2021
Dylan Graham
Aug 06, 2021
Paul Backus
Aug 06, 2021
Kirill
Aug 06, 2021
Patrick Schluter
August 06, 2021

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?

August 06, 2021

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.

August 06, 2021

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. 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.

August 06, 2021

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. 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.

Thank you for the update.

August 06, 2021

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.