draft proposal for ref counting in D
Walter Bright
newshound2 at digitalmars.com
Wed Oct 9 19:19:33 PDT 2013
On 6/28/2013 1:11 PM, Rainer Schuetze wrote:
> On 28.06.2013 21:50, Walter Bright wrote:
>> The main problem with this is the decay of a shared_ptr!C to a C. Once
>> that happens, all the memory safety goes out the window.
>
> By "decay", do mean the lowering or something else?
>
> There is no stray C reference in user code, it always gets lowered to
shared_ptr!C. Only @trusted code in shared_ptr will have to deal with "raw"
references. It is shared_ptr's responsibilty to maintain memory safety, just the
same as for AddRef and Release.
>
"Decay" means it is converted to type C in order to call functions that take C
as the 'this' pointer or C as a parameter. The problem is both type C and type
shared_ptr!C will exist.
More information about the Digitalmars-d
mailing list