shared - i need it to be useful

Atila Neves atila.neves at gmail.com
Tue Oct 23 14:13:41 UTC 2018


On Tuesday, 23 October 2018 at 01:26:57 UTC, Neia Neutuladh wrote:
> 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.

This is easily achievable with template this.



More information about the Digitalmars-d mailing list