From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA28458; Wed, 12 Jun 2002 10:10:05 +0200 (MET DST) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA28453 for caml-list@pauillac.inria.fr; Wed, 12 Jun 2002 10:10:05 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA28701 for ; Mon, 10 Jun 2002 23:57:38 +0200 (MET DST) Received: from obento.cs.caltech.edu (obento.cs.caltech.edu [131.215.44.101]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g5ALvb914965 for ; Mon, 10 Jun 2002 23:57:38 +0200 (MET DST) Received: from orchestra.cs.caltech.edu (orchestra.cs.caltech.edu [131.215.44.20]) by obento.cs.caltech.edu (Postfix) with ESMTP id E97A14039; Mon, 10 Jun 2002 14:57:35 -0700 (PDT) Received: (from mvanier@localhost) by orchestra.cs.caltech.edu (8.11.6/8.9.3) id g5ALvZg04810; Mon, 10 Jun 2002 14:57:35 -0700 Date: Mon, 10 Jun 2002 14:57:35 -0700 Message-Id: <200206102157.g5ALvZg04810@orchestra.cs.caltech.edu> X-Authentication-Warning: orchestra.cs.caltech.edu: mvanier set sender to mvanier@cs.caltech.edu using -f From: Michael Vanier To: gaurav_chanda@lycos.com Cc: caml-list@pauillac.inria.fr In-reply-to: (gaurav_chanda@lycos.com) Subject: Re: [Caml-list] Catching exceptions into strings References: Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > Date: Mon, 10 Jun 2002 07:27:15 -0700 > From: "Gaurav Chanda" > > Hello > > I want to catch exceptions into strings. I do not want to have pre-defined exceptions in my module which can be handled. I want to catch exceptions like "floating point exceptions" etc. > > I wrote the follwing piece of code: > > value divide2 p = 2/p ; > > value foo p = > try divide2 p > with > [e -> let _ = do {print_string (Printexc.to_string e);flush stdout} in 9]; > > value _ = foo 0; > > (This code is in the Camlp4 revised syntax). > > When I compile and run this code, I get : > > Floating point exception > > > However, after loading OCAML, if I use this file, I get > > value divide2 : int -> int = > value arbit : int -> int = > Division_by_zero > > That is, in the latter case, I get what I want but in the former case, I don't. Could you help me solve this problem ? > > Gaurav > Hmm. I didn't think it was possible to catch floating point exceptions in ocaml (something I'd very much like to be able to do). Why doesn't ocaml support this? Or does it? Mike ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners