shared - no read/write access

Manu turkeyman at gmail.com
Wed Mar 20 20:15:23 UTC 2019


On Wed, Mar 20, 2019 at 11:20 AM Kagamin via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On Wednesday, 20 March 2019 at 13:25:01 UTC, Stefan Koch wrote:
> > In it's current form the `shared` qualifier is not improving
> > the thread-safety
> > of D code.
>
> It does, proof: https://issues.dlang.org/show_bug.cgi?id=6585

That is most certainly not a bug, that's absolutely 100% correct behaviour.
It's absolutely not okay to pass a pointer to shared data to memcpy!
It needs some external synchronisation, and then cast shared away when
you know you have a thread-local lock on it.

> > Being conservative and disallowing all access is by far the
> > most sensible handling
> > if safety is a concern.
>
> Added noise and cognitive load on programmer causes more bugs,
> not more safety. shared is already restrictive enough to handle,
> making it more restrictive will only make people give up on it
> more often.

So, just to be clear, you favour shared being broken and meaningless
to actually meaning something and being useful?
I don't have the energy to repeat the last uber-thread on the issue;
you'll find the full discussion in the forum history.


More information about the Digitalmars-d mailing list