Direction for @safe/-dip1000

ag0aep6g anonymous at example.com
Sun Feb 13 12:58:52 UTC 2022


On 13.02.22 13:37, Florian Weimer wrote:
> Hmm.  This compiles without `-dip1000` (or `-ftransition=dip1000`), but 
> is unsafe:
> 
> ```d
> int[] global;
> 
> @safe
> void f0(int[] val) {
>      global = val;
> }
> 
> @safe
> void f1() {
>    int[3] local = [1, 2, 3];
>    f0(local);
> }
> 
> ```
> 
> It's rejected in DIP 1000 mode (both by DMD and GDC).

Yeah, bugs are plenty. And if a bug doesn't manifest with 
`-preview=dip1000`, then people are even less likely than usual to give 
a damn about it. Because DIP 1000 is going to become the default 
eventually, and then the issue will go away anyway.

It goes the other way, too: `-preview=dip1000` has safety holes that 
aren't there without the switch. But those are more likely to get fixed, 
because some people do care about getting DIP 1000 done.


More information about the Digitalmars-d mailing list