shared - i need it to be useful

Stanislav Blinov stanislav.blinov at gmail.com
Mon Oct 15 20:14:07 UTC 2018


On Monday, 15 October 2018 at 18:46:45 UTC, Manu wrote:

> 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 the risks that I think have been identified previously 
> assume that you can arbitrarily modify the data. That's 
> insanity... assume we fix that... I think the promotion 
> actually becomes safe now...?

You're still talking about implicit promotion? No, it does not 
become safe no matter what restrictions you put on `shared` 
instances, because the caller of any function that takes `shared` 
arguments remains blissfully unaware of this promotion.


More information about the Digitalmars-d mailing list