Examples:
[1]: https://news.ycombinator.com/item?id=29506814
[2]: https://gist.github.com/andrewrk/190170bc1441839644c3f15725a...
Examples:
[1]: https://news.ycombinator.com/item?id=29506814
[2]: https://gist.github.com/andrewrk/190170bc1441839644c3f15725a...
All that said, not an argument for having that, just wanted to nuance it. I think not having it and keeping the language focused on its priorities can be good, for example.
So if you have interfaces a Disposable interface is enough, the code can determine that these elements are Disposable and dispose of them when they're removed.
That's quite a lot less intense than needing a language-level concept of destructors. If you're writing a low-level language it might well be better to hook this in explicitly like Rust's Drop trait (the Drop trait is a langitem in Rust, it must exist), but in high-level languages I think you'd get almost all the value from a Disposable interface even if there is no actual language support provided.