If you could make any changes to D, what would they look like?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Mon Oct 25 19:12:52 UTC 2021

On Monday, 25 October 2021 at 18:59:51 UTC, Paul Backus wrote:
> The compiler requires you to use *some* kind of synchronization 
> to modify `x`. The error message (perhaps misguidedly) 
> *suggests* using atomic operations, but they are not actually 
> required--you could also use a mutex.

100% misguided, and the type system should not allow it. It 
cannot be assumed to be safe.

> If you're using a mutex, you do have to cast away `shared` once 
> you have locked it, since in general the compiler has no way of 
> knowing which mutex is associated with which variable.

And this is where almost all utility of shared is lost. Now you 
can no longer assume that something that isn't marked as shared 
is thread local...

What is left is syntactical clutter.

More information about the Digitalmars-d mailing list