shared - i need it to be useful

Neia Neutuladh neia at ikeran.org
Tue Oct 23 01:26:57 UTC 2018


On Mon, 15 Oct 2018 11:46:45 -0700, Manu wrote:
>>From there, it opens up another critical opportunity; T* -> shared(T)*
> promotion.
> Const would be useless without T* -> const(T)* promotion. Shared suffers
> a similar problem.
> 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.

Somehow I lost track of your reason behind the promotion.

Why not just ask to be able to call shared methods on a thread-local 
variable? No implicit casting; you need to take positive action to share 
anything. And if there's a non-shared overload, that's still preferred.

Would that be enough? Or do you have use cases that wouldn't fit there?


More information about the Digitalmars-d mailing list