Hello,
Is there an equivalent of Lisp's `unwind-protect' or Java's
"try...finally"? I wanted to write a function which changed to
another directory temporarily, and I came up with:
let in_directory d f =
let olddir = Unix.getcwd() in
(Unix.chdir d;
f();
Unix.chdir olddir)
But this won't work if f throws an exception. Any suggestions?