Why is D unpopular, redux.

deadalnix deadalnix at gmail.com
Tue May 24 16:40:43 UTC 2022


On Tuesday, 24 May 2022 at 16:21:45 UTC, Walter Bright wrote:
>> 
>> ```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.
>
> Other problems should get their own bugzilla. (Otherwise 
> bugzilla becomes unmanageable.)

It is the same problem. There are example similar to this one in 
the issue. At some point, you'll have to decide if you want to 
fix these issues or if you want to massage things in a way a 
couple of test case passes, but which don't solve anything.


More information about the Digitalmars-d mailing list