On Wednesday, 20 April 2016 at 08:10:15 UTC, Dsby wrote:
I see https://dlang.org/deprecate.html#delete
The delete will be removeed,  when will be deprecate?

and i test destroy/GC.free and delte in struct, the value is difference;

struct Struct
{
    string value = "struct";
    ~this()
    {
        writeln(value);
    }
}

void main()
{

    auto s = new Struct();
    delete s;

    writeln("----------------");

}

will printf :
struct
----------------

But in
void main()
{

    auto s = new Struct();
    s.destroy;
    GC.free(s);

    writeln("----------------");

}

will printf :
----------------
struct

If I only GC.free(s); only printf: ----------------

so, I want to know why don't destroy direct printf ?

This is according to the reference, however this behavior should probably be changed to match that of the class, which will call the destructor immediately.

Reply via email to