Destructors of the first kind are usually called just destructors and are used for resource management, and the second kind are called finalizers. These are useful for implementing weak references, caching, and various other things where you don't require objects to be destroyed at a certain point in time, but still want to get notified when they are.

And we come to some kind of Andrei's proposal to remove class destructor. In my view problem lays not in the fact, that there are two world, but in how the beings from theses world must interacting. Now we have the fire and the water but we must invent the steam engine.

Possible steam engine can look like that:
The structures with destructor disallowed as member of classes, but compiler suggest in such case tip like that
class C
{
SomeKindOfSmartPointer!S p; // or better SomeKindOfMagic!S p;
}

Reply via email to