Why D is not popular enough?

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 12 15:58:45 PDT 2016


On 8/12/16 2:04 PM, Andrei Alexandrescu wrote:
> On 08/12/2016 01:21 PM, Steven Schveighoffer wrote:
>> On 8/12/16 1:04 PM, Jonathan M Davis via Digitalmars-d wrote:
>>>
>>> Honestly, I don't think that shared is broken.
>>
>> Yes. It is broken.
>>
>> shared int x;
>> ++x; // error, must use atomicOp.
>> x = x + 1; // OK(!)
>
> How is this broken and how should it behave? -- Andrei
>

It's broken because it's inconsistent. If the compiler is going to 
complain about races in one case, but not in other equivalent cases, 
then the feature is useless.

If all I have to do to avoid compiler complaints is rewrite my 
expression in an equivalent way, then what is the point of the 
complaint? At that point, it's just a style guide.

What should it do? If I knew that, then I'd have proposed a DIP by now. 
It's not an easy problem to solve. I don't think you can "solve" races 
because the compiler can't see all interactions with data.

At first glance, it seems that shared data shouldn't be usable without 
some kind of explicit usage syntax. x = x + 1 is too innocuous looking. 
It's not going to "solve" the issue, but it makes the code easier to 
pick out.

-Steve


More information about the Digitalmars-d mailing list