|
|
|
|
|
by noste
6042 days ago
|
|
"Note how instead of saying, "Ocaml doesn't have with-open-file or unwind-protect", he says, "Here's how you have to do with-open-file and unwind-protect in Ocaml". No! You do not go around trying to turn other languages into Lisp if you want to code in Lisp. If you want to code in Lisp, you code in Lisp." What would be the OCaml solution for the problem that unwind-protect solves? In Haskell, I would use bracket, and appropriately the API documentation of bracket gives the definition of withFile as an example: withFile name mode = bracket (openFile name mode) hClose
(see http://haskell.org/ghc/docs/latest/html/libraries/base/Contr...) |
|
http://caml.inria.fr/pub/ml-archives/caml-list/2003/07/5ff66...