What exactly shared means?

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 2 15:31:39 PST 2015


On Friday, January 02, 2015 15:32:51 Steven Schveighoffer via Digitalmars-d-learn wrote:
> In fact the
> only useful aspect of shared is that data not marked as shared is
> guaranteed thread local.

That and the fact that you're supposed to be able to know which portions of
your program are operating on shared data quite easily that way, as opposed
to it potentially being scattered everywhere through a program like it can
be in languages like C++ or Java. But it definitely doesn't provide any of
the kinds of compiler guarantees that we all wanted it to. The result is
that it's arguably a bit like C++'s const in that it helps, but it really
doesn't ultimately provide strong guarantees. Personally, I think that we're
still far better off using shared the way it is than using __gshared or
being stuck with what C++ and the like have, but there's no question that
it's not where we want it to be.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list