Memory safety depends entirely on GC ?

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sun Feb 22 12:49:01 PST 2015


On 2/22/15 10:26 AM, deadalnix wrote:
> On Sunday, 22 February 2015 at 17:01:45 UTC, Andrei Alexandrescu wrote:
>> Consider
>>
>> class C { ... client code ... }
>> alias T = RefCounted!C;
>> ... more client code ...
>>
>> For reference counting to work transparently, access to the symbol "C"
>> must be restricted. RefCounted obviously needs access to it. Client
>> code should never have access to it, even in the definition of C.
>>
>
> What ??? That mean writing all library code twice, for client that want
> GC and for these who don't.

I'm not 100% convinced but it seems to me RC vs. GC is a class design 
time decision.

> That is a looser strategy.

I'm sure there are tighter ones :o).


Andrei


More information about the Digitalmars-d mailing list