It is understood that distinguish it from the deletion made by the garbage collector. I would like the explicit deletion:
It will execute something that does not run when the object disappears because the garbage collector detects that it is no longer necessary.
I know I can do something like:
to execute the additional code I want, but it does not seem quite elegant, because the object still exists.
My need arises that I am writing a small orm and the object is associated with its corresponding record in the database. I would like that deleting the object explicitly means deleting the record, while letting the die object, have no effect on the database.