Why D is not popular enough?

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 12 11:01:41 PDT 2016


On Fri, Aug 12, 2016 at 02:04:53PM -0400, Andrei Alexandrescu via Digitalmars-d 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

?!

Isn't it obvious that assigning to a shared int must require atomicOp or
a cast? `x = x + 1;` clearly has a race condition otherwise.


T

-- 
A program should be written to model the concepts of the task it
performs rather than the physical world or a process because this
maximizes the potential for it to be applied to tasks that are
conceptually similar and, more important, to tasks that have not yet
been conceived. -- Michael B. Allen


More information about the Digitalmars-d mailing list