LWN.net Logo

What, again?

What, again?

Posted May 4, 2007 16:28 UTC (Fri) by schaueho (guest, #45025)
In reply to: What, again? by dcoutts
Parent article: The Rise of Functional Languages (Linux Journal)

Speaking of running code on object destruction, SBCL includes an extension called sb-ext:finalize, doing the obvious. I would be surprised to find that only SBCL should provide something like that (actually a quick goggle search tells me that there are all sorts of implementations of this, summed up in clocc). Of course, not part of the standard means not part of the language, and as you also point out, it's an additional hassle.


(Log in to post comments)

What, again?

Posted May 7, 2007 1:06 UTC (Mon) by ncm (subscriber, #165) [Link]

No, finalization is no substitute. In fact it is actively harmful. You have no way to know when a finalization routine will happen, whether it will ever happen, what thread it will happen in, what order a series of them will be called in, or what else may be going on when they fire off. Competent Java shops typically forbid finalization except for debugging purposes, to help catch missed manual close operations.

Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds