More radical ideas about gc and reference counting
H. S. Teoh via Digitalmars-d
digitalmars-d at puremagic.com
Thu May 1 07:01:21 PDT 2014
On Wed, Apr 30, 2014 at 06:30:16PM -0700, Walter Bright via Digitalmars-d wrote:
> On 4/30/2014 4:17 PM, H. S. Teoh via Digitalmars-d wrote:
> >If we're going
> >to have dtors at all, let's do it *right*. Guarantee they always work,
> >and reject all usages that break this guarantee (like putting a struct
> >with dtor inside a class,
>
> Seems to work when I try it:
>
> bar.d:
> -------------------------
> import core.stdc.stdio;
>
> struct S { ~this() { printf("S.~this()\n"); } }
>
> class C { S s; }
>
> void main()
> {
> C c = new C();
> c = null;
> }
> -------------------------
> C:\cbx\mars>bar
> S.~this()
The proposal was to get rid of class dtors, in which case this code will
no longer work. Is that really the direction we want to move in?
T
--
Let's call it an accidental feature. -- Larry Wall
More information about the Digitalmars-d
mailing list