English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] A global exception handler...
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-07-06 (14:48)
From: Till Varoquaux <till.varoquaux@g...>
Subject: Re: [Caml-list] A global exception handler...
On 7/6/06, Jonathan Roewen <jonathan.roewen@gmail.com> wrote:
> Hi,
>
> Is it possible to register a global exception handler?
>
> I suppose I could just nest everything inside one giant function if I
> really had to, but I like my toplevel expressions ;-)
>
CamlP4 might come in handy here. I'm guessing you could rewrite your
program so that all your toplevel expressions are in one main ()
function using camlp4. It would have some limitations though: for
instance your exception handler could not use anything defined in main
(unless you where using references). I'm guessing it's not so bad
because whatever happens you cannot have a global exception handler
relying to much on stuff defined in your programm.
> Jonathan