Tell us your DIP1000 woes
Juraj
zero at vec4.xyz
Mon Aug 26 16:06:53 UTC 2024
On Sunday, 25 August 2024 at 13:10:22 UTC, Mike Parker wrote:
> Second, we'd like to get a number of examples of problems
> people have had with using DIP1000 that haven't shown up in
> Bugzilla. Walter wants to be as certain as he can whether such
> issues are fixable or if the design is fundamentally flawed.
As stated in my previous reply, I dont have problems with DIP1000
as I just ignore it, because of bad ergonomics.
But I felt guilty for bashing something I haven't used in years,
so here is first thing I tried.
All my shenanigans are catched without `-dip1000`.
(I over-use `@safe` just to be sure)
```d
@safe:
struct S {
int x;
S* s_ptr_0;
S* s_ptr_1;
}
S* g_ptr = null;
S* goo(return ref S sp) @safe => &sp;
S foo(int v) @safe {
S s0 = S(333);
S s1 = S(v);
void ez_escape() @safe {
auto res = goo(s1);
g_ptr = res;
}
ez_escape();
() @safe {
S* moo(return ref S sp)@safe => &sp;
s1.s_ptr_0 = moo(s0);
}();
() @safe {
S* moo(S* sp)@safe => sp;
s1.s_ptr_1 = moo(&s0);
}();
return s1;
}
```
More information about the Digitalmars-d
mailing list