Why is D unpopular, redux.

deadalnix deadalnix at gmail.com
Tue May 24 13:13:24 UTC 2022


On Tuesday, 24 May 2022 at 05:39:50 UTC, Walter Bright wrote:
> On 5/22/2022 6:31 AM, deadalnix wrote:
>> https://issues.dlang.org/show_bug.cgi?id=1983
>
> It's been fixed already. Just nobody closed it.

No.

```d
struct S {
     void delegate() dg;
}

void main() {
     int x = 42;
     immutable S s = { dg: () { x++; } };
     s.dg();

     import std.stdio;
     writeln(x);
}
```

This still compiles and run and mutates a variable through an 
immutable pointer. This variable could be shared too because 
immutable is safe to share.


More information about the Digitalmars-d mailing list