Proposal 2: Exceptions and @nogc

Nick Treleaven via Digitalmars-d digitalmars-d at puremagic.com
Sat Apr 15 04:51:48 PDT 2017


On Thursday, 13 April 2017 at 05:29:28 UTC, Dukc wrote:
> The reason it needs:
>
> {   scope Object ob = new RefCountableType("foo");
>     scope ob2 = ob;
>     ob = new RefCountableType("bar");
> }
>
> The "foo" instance would leak if the destruction would be done 
> by calling at end of scope.

I assume you mean if the compiler calls `delete ob` just before 
}. What I described would be implemented by the compiler deleting 
the original value of ob just before }.


More information about the Digitalmars-d mailing list