On Wednesday, 5 July 2017 at 07:25:34 UTC, Martin Nowak wrote:
On Wednesday, 5 July 2017 at 01:40:49 UTC, Dsby wrote:
Will add in language : @ref @weak?
is it DIP47?
Or in library?
We should be able to do it as library types.
The only case we currently know that might need help from the
compiler, is passing multiple mutable rc/uniq references.
int boom(ref RC!S a, ref RC!int b)
{
destroy(a);
return b; // a might have been the sole owner of b
}
We might get away with disallowing calls with arguments, where
one potentially owns the other. It looks like a minor use-case
to me.
Incrementing the ref-count around the call was another option,
but that wouldn't work with unique ownership.
Wait for the std.rc.