News for hackers. Stuff that matters.
Re:Pre-Pooping Your Pants with Rust by mcguire on Monday April 27, 2015 @12:02PM (#9447138)
There's a reason why finalizers aren't a widely used technique in Java and why Python's cycle detector simply stacks things with destructors in an out-of-the-way location.
Re:Pre-Pooping Your Pants with Rust by Jweb_Guru on Monday April 27, 2015 @12:19PM (#9447237)
Those languages have bigger problems than Rust here. Rust can still recover correct behavior for APIs like scoped because it can ensure (using lifetimes) that the relevant value never escapes the stack frame. In the languages you mention (and most other languages with a "with" or "IDisposable" equivalent), the "close" equivalent, or even the finalizer, can be called on objects that still have valid references to them hidden in another object or thread.
Re:Pre-Pooping Your Pants with Rust by mcguire on Monday April 27, 2015 @06:47PM (#9449585)
I was actually speaking of the original finalize method it Java[1]. There's no guarantee that it will be called, there's no guarantee when it will be called if it is, and as a result it shouldn't be used to reclaim resources or much of anything, really. Where "should" is so strong in this case that I've never seen it in the wild, even given the N-monkeys code that I have seen.

[1] http://www.informit.com/articles/article.aspx?p=1216151&seqN...