On Monday, 15 October 2018 at 18:46:45 UTC, Manu wrote:
Current situation where you can arbitrarily access shared members
undermines any value it has.

The value of shared is existence of thread-local data that's guaranteed to be not shared, so you don't need to worry about thread-local data being shared, and shared protects that value well.

Assuming this world... how do you use shared?

Unique solution for each case.

If you write a lock-free queue for instance, and all the methods are `shared` (ie, threadsafe), then under the current rules, you can't
interact with the object when it's not shared, and that's fairly
useless.

Create it as shared.

Assuming the rules above: "can't read or write to members", and the understanding that `shared` methods are expected to have threadsafe implementations (because that's the whole point), what are the risks from allowing T* -> shared(T)* conversion?

All data becomes possibly shared, so you can't assume it's unshared, effectively C-style sharing. BTW D supports the latter already.

Reply via email to