Safe reference counting cannot be implemented as a library

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Tue Oct 27 14:20:58 PDT 2015


On 10/27/2015 04:45 PM, rsw0x wrote:
> On Tuesday, 27 October 2015 at 20:41:49 UTC, Jonathan M Davis wrote:
>> On Tuesday, 27 October 2015 at 20:19:42 UTC, PuglyWUgly wrote:
>>>  Why care about this?
>>>
>>>  Even Rust doesn't try to solve this problem...because it isn't
>>> really a problem in practice.
>>>
>>>  In c++/rust code you use value/unique types 99.9% of the time, and
>>> reference counting is only for shared/aliased objects.
>>>
>>>
>>>  Reference counting == rare and unimportant
>>
>> Really? I've seen tons of C++ code that's written using smart pointers
>> with objects living on the heap which then get passed around all over
>> the place.
>
> if they're using shared_ptr all over the place, they're doing it wrong.
> shared_ptr is supposed to be a last resort

This is awesomely Kafkian. So we have no problem after all - just like 
Go with generics :o). -- Andrei



More information about the Digitalmars-d mailing list