My Reference Safety System (DIP???)

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Mon Mar 2 12:40:44 PST 2015


On Monday, 2 March 2015 at 20:36:53 UTC, Marc Schütz wrote:
> Interesting approach. I will have to think about that. But I 
> think it does not really work. Your example hides the fact that 
> there are actually two types involved (or can be): an RC 
> wrapper, and the actual class. foo() would need to take at 
> least `c1` as the wrapper type `RC!C`, not `C` itself, 
> otherwise it couldn't copy it. But that defeats the purpose of 
> borrowing, that it neutralizes the actual memory management 
> strategy; foo() should know whether `c1` is reference counted 
> or not.

Please reread. I'm assuming a refcounting system like Andrei's 
proposal for objects.

The result would be the same for a RefCounted wrapper (a solution 
that I would prefer) in the sense you'd have to copy the wrapper 
to get ownership of it before being able to assign to it.


More information about the Digitalmars-d mailing list