Discussion about D at a C++ forum

Steven Schveighoffer schveiguy at yahoo.com
Mon Jan 9 05:58:22 PST 2012


On Sun, 08 Jan 2012 18:28:54 -0500, Mehrdad <wfunction at hotmail.com> wrote:

> 7. Unstable language. They're currently considering doing things like  
> removing "delete" as it's apparently deprecated (which will officially  
> make it not usable as an SP language).
>     Looks 100% correct. Removing 'delete' /does/ make D unusable as an  
> SP language... unless you ignore the GC completely, which isn't even  
> possible, practically speaking.

C doesn't have delete.

But removing delete isn't the problem anyways.  Here is the problem (which  
exists with delete present in the language):

class C
{
    private int[] buf;
    this() { buf = new int[5]; }
    ~this() {/* can't destroy buf here */}
}

void main()
{
    auto c = new C;
    delete c; // doesn't destroy c.buf
}

What we need is a way to hook deterministic destruction vs. GC  
destruction.  Only then, a SP language will you be.

-Steve


More information about the Digitalmars-d mailing list