From: "Jonathan Roewen" <jonathan.roewen@gmail.com>
To: "Nicolas Pouillard" <nicolas.pouillard@inria.fr>
Cc: "Till Varoquaux" <till.varoquaux@gmail.com>,
OCaml <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] A global exception handler...
Date: Fri, 7 Jul 2006 03:33:38 +1200 [thread overview]
Message-ID: <ad8cfe7e0607060833w312b568t3a6abd89ce69153f@mail.gmail.com> (raw)
In-Reply-To: <cd67f63a0607060825h7e701760uf10102c0a9233df2@mail.gmail.com>
> $ camlp4o global_handler.cmo -printer OCaml global_handler_test.ml
> try
> let module Main =
> struct
> open Format
> let f1 x = printf "f1 %d@." x
> let f2 x = printf "f2 %f@." x
> let f3 x = printf "f3 %s@." x
> let _ = f1 1
> let _ = f2 1.1
> let _ = f3 "1.1.1"
> let _ = raise (Failure "test")
> let global_handler e =
> (* Note that I need to give the complete name for eprintf since
> Format is not opened in the new environment of global_handler. *)
> Format.eprintf "global_handler: %s@." (Printexc.to_string e)
> end
> in ()
> with
> | e ->
> (fun e -> Format.eprintf "global_handler: %s@." (Printexc.to_string e)) e
>
Ah, defining a module inside a function is a neat trick! I didn't
think of that. Well, I guess it couldn't hurt to do that with all the
modules which could cause trouble at runtime...
Can I build the new camlp4 with 3.09.2 tools?
Jonathan
next prev parent reply other threads:[~2006-07-06 15:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-06 14:39 Jonathan Roewen
2006-07-06 14:48 ` Till Varoquaux
2006-07-06 15:25 ` Nicolas Pouillard
2006-07-06 15:33 ` Jonathan Roewen [this message]
2006-07-06 15:37 ` Nicolas Pouillard
2006-07-06 15:39 ` Jonathan Roewen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ad8cfe7e0607060833w312b568t3a6abd89ce69153f@mail.gmail.com \
--to=jonathan.roewen@gmail.com \
--cc=caml-list@yquem.inria.fr \
--cc=nicolas.pouillard@inria.fr \
--cc=till.varoquaux@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox