My Reference Safety System (DIP???)

via Digitalmars-d digitalmars-d at
Tue Mar 3 04:20:27 PST 2015

On Monday, 2 March 2015 at 20:40:45 UTC, deadalnix wrote:
> 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.

Then you're in the wrong thread ;-)

> 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