[Dlang-study] [lifetime] Few root decisions to take on RC classes

deadal nix deadalnix at gmail.com
Sun Nov 1 11:37:17 PST 2015


That doesn't follow. C++ doesn't have a GC to pick up the cycles, not it
bakes RC into the language (and in fact, it is not that uncommon to see
C++'s project rolling their own RC mechanism).

2015-11-01 11:28 GMT-08:00 Andrei Alexandrescu <andrei at erdani.com>:

> On 11/01/2015 02:16 PM, deadal nix wrote:
>
>> 2015-11-01 6:02 GMT-08:00 Andrei Alexandrescu <andrei at erdani.com
>> <mailto:andrei at erdani.com>>:
>>
>>     On 10/31/2015 11:35 PM, Michel Fortin wrote:
>>
>>         I think it'd be more important to talk about auto-nulling weak
>>         references. That's a general concept that is necessary if you want
>>         reference counting to be useful and safe at the same time.
>>
>>
>>     Agreed. We need to put weak pointers in the initial DIP and carry
>>     them through.
>>
>>
>> It' doesn't looks like this kind of mechanism should be baked into the
>> language. It come with a cost that maybe one doesn't want to pay. Maybe
>> one is ok to fallback on the GC on that one. Maybe it is preferable to
>> provide several kind of RC. Adn weak reference are just one variation
>> one may wish.
>>
>
> After much deliberation and collective experience, C++ chose to support
> weak_ptr as a complement to shared_ptr, in spite of the well-understood
> performance overhead. It is sensible to draw from that experience as well;
> also, I agree with Michel that safety makes it all the more important that
> we design weak pointer support in from day one. -- Andrei
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dlang-study/attachments/20151101/ff97788e/attachment.html>


More information about the Dlang-study mailing list