Is "delete" really going away?

Timon Gehr timon.gehr at gmx.ch
Sun Jul 29 06:16:06 PDT 2012


On 07/29/2012 03:03 PM, Minas Mina wrote:
>
> Having a destructor and that you know when is going to be called is VERY
> useful!
> So by removing the "delete" keyword, what happens? We won't have a way
> to destroy objects in a predictable way anymore? (I'm not talking about
> structs in any way).
>
> Thanks

import std.stdio;
void main(){
     auto c = new class{ ~this(){writeln("destroyed!");} };
     version(future) destroy(c);
     else clear(c);
}

clear is being renamed to destroy starting from the next release IIRC.


More information about the Digitalmars-d-learn mailing list