collectNoStack should be axed

Steven Schveighoffer schveiguy at gmail.com
Mon Apr 22 01:26:29 UTC 2024


On Sunday, 21 April 2024 at 19:57:04 UTC, Daniel N wrote:
> Why do we even support destructors for GC allocated objects? 
> You can't depend on it closing file-descriptors or other 
> resources.

You can't depend on the GC running. But if for some reason it 
does get run, why wouldn't you close the resource instead of 
leaking it?

Note that even if you are cleaning up the descriptor manually, 
using `destroy` is a valid mechanism.

I used destructors to close things like this a long time ago in a 
project and it worked OK.

-Steve


More information about the Digitalmars-d mailing list