Smart pointers instead of GC?

Manu turkeyman at gmail.com
Mon Feb 3 19:31:55 PST 2014


On 4 February 2014 12:57, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org
> wrote:

> On 2/3/14, 5:36 PM, Adam Wilson wrote:
>
>> You still haven't dealt with the cyclic reference problem in ARC. There
>> is absolutely no way ARC can handle that without programmer input,
>> therefore, it is simply not possible to switch D to ARC without adding
>> some language support to deal with cyclic-refs. Ergo, it is simply not
>> possible to seamlessly switch D to ARC without creating all kinds of
>> havoc as people now how memory leaks where they didn't before. In order
>> to support ARC the D language will necessarily have to grow/change to
>> accommodate it. Apple devs constantly have trouble with cyclic-refs to
>> this day.
>>
>
> The stock response: weak pointers. But I think the best solution is to
> allow some form of automatic reference counting backed up by the GC, which
> will lift cycles.


I agree, I suggested that a few times, and Adam ignored it each time.
With this approach, performance/aggressive users would be able to disable
the backing GC, and deal with cycles manually, taking responsibility for
leaking themselves.
All other users would be able to ignore the problem and have it collected
by the backing GC, business as usual.

The advantage here is *choice*. Users would then have a fully automated
system and/or have quite articulate control over it's influence on their
app.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140204/cd1d1c84/attachment.html>


More information about the Digitalmars-d mailing list