From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 7B121BB83 for ; Thu, 6 Jul 2006 17:33:39 +0200 (CEST) Received: from nz-out-0102.google.com (nz-out-0102.google.com [64.233.162.200]) by nez-perce.inria.fr (8.13.6/8.13.6) with ESMTP id k66FXebu019154 for ; Thu, 6 Jul 2006 17:33:40 +0200 Received: by nz-out-0102.google.com with SMTP id x3so1012668nzd for ; Thu, 06 Jul 2006 08:33:38 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=QeT5T3Tc7egaycKw8RIWmBYknchRcnqdDpE3WOFlp2Nkuwn4aUfLO4yLCPYKhhh0EFh0T23kodKzjf6PA54zb+roNJLVO/iIwDQ13A//GM/y5gCKGgkewTTBsletN6DuvlN7b5b2Z5CJ21hUWHFUPOntCFGZVxzU5FTecqb7vQ4= Received: by 10.36.80.17 with SMTP id d17mr1047512nzb; Thu, 06 Jul 2006 08:33:38 -0700 (PDT) Received: by 10.36.101.10 with HTTP; Thu, 6 Jul 2006 08:33:38 -0700 (PDT) Message-ID: Date: Fri, 7 Jul 2006 03:33:38 +1200 From: "Jonathan Roewen" To: "Nicolas Pouillard" Subject: Re: [Caml-list] A global exception handler... Cc: "Till Varoquaux" , OCaml In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <9d3ec8300607060748s18ad08c6v282af9bc795099c8@mail.gmail.com> X-j-chkmail-Score: MSGID : 44AD2D54.001 on nez-perce : j-chkmail score : X : 0/20 1 X-Miltered: at nez-perce with ID 44AD2D54.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; handler:01 camlp:01 handler:01 cmo:01 ocaml:01 struct:01 printf:01 printf:01 eprintf:01 eprintf:01 printexc:01 printexc:01 runtime:01 camlp:01 caml-list:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=DNS_FROM_RFC_ABUSE,RCVD_BY_IP autolearn=disabled version=3.0.3 > $ 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