More radical ideas about gc and reference counting

Brad Anderson via Digitalmars-d digitalmars-d at puremagic.com
Wed Apr 30 16:40:32 PDT 2014


On Wednesday, 30 April 2014 at 23:34:33 UTC, Andrei Alexandrescu 
wrote:
> On 4/30/14, 4:19 PM, froglegs wrote:
>>  Here is an alternative:
>>
>>  1. classes are unique by default, they cannot be shared. No 
>> GC or RF
>> required, and covers 90% of objects.
>
> Where does 90% come from? On the contrary, it seems to me 
> unique references are rather rare and fleeting. -- Andrei

Yeah, 90% doesn't feel right to me. In C++ I try to use 
unique_ptr instead of shared_ptr wherever possible but I find I'm 
often not able to because my references need to be held in 
several places for efficiency. I'd say I'm more like 90% 
reference counted, 10% unique throughout my 300kloc codebase.


More information about the Digitalmars-d mailing list