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 EAA28298; Wed, 12 Mar 2003 04:43:34 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 EAA04565 for ; Wed, 12 Mar 2003 04:43:32 +0100 (MET) Received: from mail2.hypermall.com (mail2.hypermall.com [216.241.37.118]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h2C3hVX00252 for ; Wed, 12 Mar 2003 04:43:32 +0100 (MET) Received: from [216.241.35.41] (helo=swordfish) by mail2.hypermall.com with esmtp (Exim 3.36 #1) id 18sx9O-0005AX-00 for caml-list@pauillac.inria.fr; Tue, 11 Mar 2003 20:43:30 -0700 From: mgushee@havenrock.com To: caml-list@pauillac.inria.fr Date: Tue, 11 Mar 2003 20:43:26 -0700 MIME-Version: 1.0 Subject: RE: [Caml-list] Checked exceptions and type inference Message-ID: <3E6E4A6E.32379.5FAC926@localhost> In-reply-to: <46D5FE1E.20DB90B0.00958B05@netscape.net> X-mailer: Pegasus Mail for Windows (v4.02) Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body X-Spam: no; 0.00; mgushee:01 havenrock:01 caml-list:01 inference:01 00,:99 qlogic:01 hashtable:01 gushee:01 englewood:01 compiler:01 handler:01 exception:02 failing:02 string:03 wrote:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On 11 Mar 2003 at 22:00, Arturo Borquez wrote: > Brian Hurt wrote: > >Java treats checked exceptions as part of the type signature of the > >function. As such, it seems to me that as such, type inference would work > >to propogate most of this information in a more convient way. > let x = try String.sub str pos len with _ -> "" in > .... > > in this case failing String.sub is returning a string, > and the type inference system will check it that way. > > Perhaps I don't understand what migth be a > 'checked exception' in ML. I am missing something?. > can you explain it with an example? I guess you must be unfamiliar with Java terminology. A checked exception is one that the programmer must provide for in any method that can raise it, either by writing a handler or by indicating in the method signature that the method may raise that exception. They're called "checked" because the compiler checks whether they are handled. For example, if you have a method getConfig() that reads a configuration file, you have to provide for possible I/O errors: either try { /* open and read file */ } catch (IOException e) { /* handle exception */ } Within the body of the method, or a signature such as: public HashTable getConfig() throws IOException { /* do whatever */ } so in the latter case, the exception is indeed part of the method signature. Unchecked exceptions are generally those resulting from unpredictable conditions, such as OutOfMemoryError, NullPointerException, and ThreadDeath. -- Matt Gushee Englewood, CO USA ------------------- 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