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 VAA15329; Mon, 19 Aug 2002 21:15:04 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA15317 for ; Mon, 19 Aug 2002 21:15:03 +0200 (MET DST) Received: from hirsch.in-berlin.de (hirsch.in-berlin.de [192.109.42.6]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g7JJF2T20486; Mon, 19 Aug 2002 21:15:02 +0200 (MET DST) Received: from hirsch.in-berlin.de (localhost [127.0.0.1]) by hirsch.in-berlin.de (8.12.1/8.12.1/Debian -2) with ESMTP id g7JJF1qi020820 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NOT); Mon, 19 Aug 2002 21:15:01 +0200 Received: (from uucp@localhost) by hirsch.in-berlin.de (8.12.1/8.12.1/Debian -2) with UUCP id g7JJF1Cj020798; Mon, 19 Aug 2002 21:15:01 +0200 X-Envelope-From: oliver@first.in-berlin.de X-Envelope-To: caml-list@inria.fr Received: from localhost (oliver@localhost) by first.in-berlin.de (8.7.6/8.7.3) with SMTP id TAA00779; Mon, 19 Aug 2002 19:44:50 +0200 Date: Mon, 19 Aug 2002 19:44:50 +0200 (MET DST) From: Oliver Bandel To: Xavier Leroy cc: caml-list@inria.fr Subject: Re: [Caml-list] Silently discarded exceptions? In-Reply-To: <20020819155427.C6276@pauillac.inria.fr> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello Xavier, thanks for your answer. On Mon, 19 Aug 2002, Xavier Leroy wrote: > > I have a test on the first char of a string (Position 0). > > If the string is "" then normally (in the toplevel) an > > exception is thrown. > > > > When compiling with ocamlc, the program does not > > mention that there was an Exception: it silently > > stops the execution of my test. > > Chances are that your program contains a "try ... with x -> ..." > or "try ... with _ -> ..." that catches the exception arising from the > invalid string access. Well, I have now tested the problem again. For this test I grabbed the code of question out of the ml-file and tested it again with ocamlc. The executable has told me the Exception, then. So, I browsed over my code in the ml-file and found, where the difference is: In the function with the String.get- function I did not used try ... with ... but in a function, that calls this function! (Propagation of exceptions to higher levels of the program...) I think this could be a possible problem in development with Ocaml, and maybe it's better to explicitly catch the exceptions. I have to look into my code again and check, if I can use the _ or better do not use it. Maybe it's better, when I write explicitly matches. Do you have a hint, how to handle such things in a clean way, which is useful? Is it possible to catch exceptions from specific Modules, and match the exception by the _ ? For example: If there is an Invalid_argument "String.get" can I match on all "String."-exceptions, like "String._" or so? TIA, Oliver ------------------- 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