DIP 1028---Make @safe the Default---Community Review Round 1
newshound2 at digitalmars.com
Wed Jan 8 02:33:34 UTC 2020
On 1/7/2020 10:38 AM, Mathias Lang wrote:
> Except that I do not control all the code I write. Some libraries will use
> `@safe` everywhere, some won't. And mixing them becomes a nightmare. For
> example, I'd be very happy to live without `@safe`, but I use Vibe.d, which
> forces `@safe` on me because some people wanted to be able to use `@safe` in the
> first place. This is the kind of ecosystem split people keep talking about.
Defaulting to @safe will ironically mitigate these types of issues.
I understand this will cause some disruption. I don't know of any way to avoid
it. The best we've come up with is -preview/-revert switches.
The worst you'll have to do is manually add @system to individual functions.
> If I wanted to be using Rust, I would be using Rust.
I don't want to use Rust, either.
> But put in simpler terms: Where is `@safe` reference counting ?
There have been a number of DIPs which help in that direction.
> And then, nobody will try it unless druntime / Phobos is compiled with it. But
> then we're back to the point where it's not really opt-in because of link
> failures. I'll add more of that on the PR itself.
For Phobos to work with and without the -preview switch, it'll likely need
specific @system/@trusted/@safe annotations on all non-inferred functions. It's
mostly done already anyway, this will just help us finish the job.
More information about the Digitalmars-d