Re: A look at the D programming language by Ferdynand Górski

Ali Çehreli acehreli at yahoo.com
Mon Jan 7 14:14:46 PST 2013


On 01/07/2013 01:57 PM, Phil Lavoie wrote:

 > I meant scope objects work fine in most cases, but sometimes its good to
 > explicitly delete objects on the heap.

Usually, what is needed is to just finalize the object. The memory that 
it sits on should still be managed by the GC.

So, now there is destroy():

   http://dlang.org/phobos/object.html#.TypeInfo.destroy

         auto variable = new Foo;
         // ... later ...
         destroy(variable);

Ali



More information about the Digitalmars-d-announce mailing list