Smart pointers instead of GC?

Paulo Pinto pjmlp at progtools.org
Tue Feb 4 00:35:17 PST 2014


On Tuesday, 4 February 2014 at 02:57:00 UTC, Andrei Alexandrescu 
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.
>
> Andrei

This is the approach taken by Cedar on the Mesa system.

"On Adding Garbage Collection and
Runtime Types to a Strongly-Typed,
Statically-Checked, Concurrent Language"

http://www.textfiles.com/bitsavers/pdf/xerox/parc/techReports/CSL-84-7_On_Adding_Garbage_Collection_and_Runtime_Types_to_a_Strongly-Typed_Statically-Checked_Concurrent_Language.pdf

--
Paulo


More information about the Digitalmars-d mailing list