idiom for clearing up resources?
Mon Aug 25 13:52:33 CEST 2003
Is there an idiom for initializing and clearing up resources
(e.g. files) needed by an Erlang function, in such a way that the
clear-up code gets called even in the face of an error?
ok = file:make_dir("c:/tmp/foo"),
% do some stuff
ok = file:del_dir("c:/tmp/foo").
I want the last line to be called even if "do some stuff" crashes.
Basically, coming from a C++ background, this is the code I would
have put in something's destructor, and I am wondering what Erlangers
More information about the erlang-questions