Sharing in D

Sean Kelly sean at invisibleduck.org
Fri Aug 1 08:55:56 PDT 2008


== Quote from Walter Bright (newshound1 at digitalmars.com)'s article
> superdan wrote:
> > i grok that. my problem is that your shared doesn't help me with
> > writing good code in that case. ++x is just wrong for shared x. i'd
> > rather have it disabled or somethin'.
> Actually, the current plan is that ++ would be disabled for shared
> lvalues. Reads and writes to them would be done through intrinsic
> functions, which would make clear the order in which reads and writes
> are done.
> Sure, it won't be pretty, but there won't be any ambiguity of the order
> in which things happen.

A totally worthwhile tradeoff IMO.  The alternative would be to
have ++ call INC if supported or a CAS loop if not, and that's
a hidden cost that may surprise users.  It could always be
enabled later if needed anyway.

Oh, and darn you for getting me moderately enthusiastic for
D 2.0 :-)


Sean



More information about the Digitalmars-d mailing list