News for hackers. Stuff that matters.
Re:Rust: Dropping heavy things in another thread can make yo... by cesarb on Saturday May 30, 2020 @10:21PM (#23366642)
In my experience, try-with-resources is inferior to RAII, since it's very easy to forget (that is, it's very easy to do "Foo x = bar();" instead of "try (Foo x = bar()) { ... }"), leading to resource leaks. More than once I have added a finalizer to an AutoCloseable class just to warn loudly if close() hasn't been called; unfortunately, there's no way that I know of to suppress the finalizer once close() is called, so the GC still has to do all the work to call the finalizer even when the class was used correctly.

There are no comments on this comment yet.