https://issues.dlang.org/show_bug.cgi?id=8295

--- Comment #12 from anonymous4 <dfj1es...@sneakemail.com> ---
(In reply to Marco Leise from comment #10)
> You can tell where I'm going: Copy a shared reference counting struct and it
> is no longer shared except for the data it references.
If you can solve it for const, the same solution can work for shared, but it
doesn't deny overloading on qualifiers.

> So in my brain there
> is no "shared(RefCounter!T)" that atomically decrements the counter. For
> that I would have to create another "SharedRefCounter". Whether or not the
> payload is shared is independent of that.
It can be done either way, albeit the latter can provide more safety. In the
end it's a design decision.

> I don't know what I can say about thread local allocators. You can still
> share data allocated with them as long as upon destruction you queue the
> item in for freeing on the correct thread's "items to be free'd list".
The destructor needs to know whether it needs to resort to this or not. Shared
destructor would do it, unshared wouldn't.

> Value types can always be copied stripping their top-level qualifiers!
That's fine, but this problem isn't solved yet for transitive qualifiers.

--

Reply via email to