implicit conversions to/from shared
Kagamin via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jul 12 08:46:52 PDT 2016
On Tuesday, 12 July 2016 at 14:38:27 UTC, ag0aep6g wrote:
> I'm not sure what you're saying here. Should unsafe reading and
> writing of shared types simply be allowed and have the common
> syntax (as it is now), and the programmer should make sure that
> things are set up correctly?
>
> That's a reasonable stance, but it's not the one that D takes
> towards shared when `shared int x; ++x` is deprecated.
shared only differentiates between shared and unshared data.
Teaching people to write legit concurrent code is a different
task. Increment of a shared variable doesn't have a compelling
use case so whatever happens to it is not important, just storing
shared data is more common.
> Supporting non-atomic load in atomicLoad would be weird,
> wouldn't it? It would be opposite of what it says on the label.
The name can be different, e.g. fast load, which better reflects
its purpose.
> Would the point be that it calls the shared postblit (unlike
> casting shared away and then copying)? As mentioned above, I'd
> hope that a function that does that can be written.
Postblit is a problem with casting. Performance is a problem with
atomicLoad.
More information about the Digitalmars-d
mailing list