Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] beginner question about camlp4
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Charles Martin <joelisp@y...>
Subject: Re: [Caml-list] beginner question about camlp4

>Are you sure that's right?  I think (f chan) executes before the call
>to protect, and you want protect to execute f:

That's my punishment for not cutting and pasting actual code :)

let with_input_file fname f =
  let chan = open_in fname in
  protect (fun () -> f chan) (fun () -> close_in chan)


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr