Smart pointers instead of GC?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Feb 1 23:35:21 PST 2014


On 2/1/14, 10:00 PM, Frank Bauer wrote:
> On Sunday, 2 February 2014 at 05:41:53 UTC, Andrei Alexandrescu wrote:
>> Sure. While you're young typecheck this:
>>
>> class A {
>>    auto stuff() { ...; return this; }
>> }
>>
>>
>> Andrei
>
> It would be a Borrowed!A, I would say, no matter how an A is allocated.
> A GC!A, an ARC!A and an Owning!A convert equally well to a Borrowed!A.
> As long as the Borrowed!A is in use (i.e. scope) after stuff() returns,
> the A object must not be freed (compiler enforced). Would that make sense?

No.

What I'm driving at is that right now the type is A, as is in a variety 
of other situations. It would be a whole different language that would 
be wholly incompatible with D.


Andrei



More information about the Digitalmars-d mailing list