shared - i need it to be useful

Manu turkeyman at gmail.com
Tue Oct 16 18:10:33 UTC 2018


On Tue, Oct 16, 2018 at 6:35 AM Steven Schveighoffer via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On 10/16/18 9:25 AM, Steven Schveighoffer wrote:
> > On 10/15/18 2:46 PM, 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.
> >>
>
> Oh, I didn't see this part. Completely agree with Timon on this, no
> implicit conversions should be allowed.

Why?

> If you want to have a lock-free implementation of something, you can
> abstract the assignments and reads behind the proper mechanisms anyway,
> and still avoid locking (casting is not locking).

Sorry, I don't understand what you're saying. Can you clarify?


More information about the Digitalmars-d mailing list