[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2000-11-17 (12:12) |
From: | Colin Walters <walters@c...> |
Subject: | unwind-protect? |
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?