Reliable clean-up in Mathematica
For better or worse, Mathematica provides a wealth of constructs that allow you to do non-local transfers of control, including Return , Catch / Throw , Abort and Goto . However, these kinds of non-local transfers of control often conflict with writing robust programs that need to ensure that clean-up code (like closing streams) gets run. Many languages provide ways of ensuring that clean-up code gets run in a wide variety of circumstances; Java has its finally blocks, C++ has destructors, Common Lisp has UNWIND-PROTECT , and so on. In Mathematica, I don't know how to accomplish the same thing