shared - i need it to be useful

Manu turkeyman at gmail.com
Thu Oct 18 21:24:37 UTC 2018


On Thu, Oct 18, 2018 at 1:10 PM Stanislav Blinov via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On Thursday, 18 October 2018 at 19:51:17 UTC, Erik van Velzen
> wrote:
> > On Thursday, 18 October 2018 at 19:26:39 UTC, Stanislav Blinov
>
> >>> Manu said clearly that the receiving thread won't be able to
> >>> read or write the pointer.
> >>
> >> Yes it will, by casting `shared` away. *Just like* his
> >> proposed "wrap everything into" struct will. There's exactly
> >> no difference.
> >>
>
> > Casting is inherently unsafe. Or at least, there's no
> > threadsafe guarantee.
>
> So? That's the only way to implement required low-level access,
> especially if we imagine that the part of Manu's proposal about
> disabling reads and writes on `shared` values is a given. It's
> the only way to implement Manu's Atomic!int, or at least
> operation it requires, for example.

@trusted code exists, and it's the foundation of the @safe stack.
I think you're just trying to be obtuse at this point.


More information about the Digitalmars-d mailing list