More radical ideas about gc and reference counting

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Thu May 1 15:29:28 PDT 2014


On Thu, 01 May 2014 17:33:56 -0400, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> On 5/1/14, 2:21 PM, Steven Schveighoffer wrote:
>> On Thu, 01 May 2014 16:03:06 -0400, Andrei Alexandrescu
>> <SeeWebsiteForEmail at erdani.org> wrote:
>>
>>> On 5/1/14, 12:52 PM, "Nordlöw" wrote:
>>>>>> into a class. I'm inclined to say that we should outright prohibit
>>>>>> that,
>>>>>
>>>>> That can't happen.
>>>>
>>>> Why is that?
>>>
>>> (1) Too much breakage, (2) would disallow a ton of correct code, (3)
>>> no reasonable alternative to propose. We'd essentially hang our users
>>> out to dry. -- Andrei
>>
>> class C
>> {
>>     void finalizer();
>>     private struct S {
>>       C owner;
>>       ~this() {
>>          owner.finalize();
>>       }
>>     }
>>     private S s;
>> }
>>
>> You aren't helping anything.
>
> There's a misunderstanding somewhere. -- Andrei

The above is or is not allowed under the new proposal?

You said class dtors will cease to exist, but that you can have structs  
(with dtors?) embedded in them.

I defined a de-facto destructor for a class, when none is allowed. Unless  
you are planning on having classes not call the struct dtors?

-Steve


More information about the Digitalmars-d mailing list