I think having the delete keyword for classes was a very good thing, altough I don't know the problems it has for the GC and probably other things.

Consider this scenario:
class Base
{
        // ...
}

class Derived : Base
{
        // ...
        
        FILE *f;
        
        this()
        {
                f = fopen(...);
        }
        
        ~this()
        {
                fclose(f);
        }
}

void main()
{
        Base *b = new Derived();
        delete b; // call the copy constructor
        
        b = // something else...
}


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

Reply via email to