From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 80C8FBC0A for ; Mon, 11 Dec 2006 16:55:23 +0100 (CET) Received: from furbychan.cocan.org (furbychan.cocan.org [80.68.91.176]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id kBBFtMmM026233 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Mon, 11 Dec 2006 16:55:23 +0100 Received: from rich by furbychan.cocan.org with local (Exim 3.35 #1 (Debian)) id 1GtnUn-0005mQ-00; Mon, 11 Dec 2006 15:55:13 +0000 Date: Mon, 11 Dec 2006 15:55:13 +0000 To: Chris King Cc: caml-list@inria.fr Subject: Re: [Caml-list] Today's inflamatory opinion: exceptions are bad Message-ID: <20061211155513.GA22044@furbychan.cocan.org> References: <875c7e070612091935q2388092dr51538ff444d0e3a6@mail.gmail.com> <20061210180426.GA5347@furbychan.cocan.org> <875c7e070612101527j3d649226y3cade255af0cd6cd@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <875c7e070612101527j3d649226y3cade255af0cd6cd@mail.gmail.com> User-Agent: Mutt/1.5.9i From: Richard Jones X-Miltered: at concorde with ID 457D7F6A.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; o'caml:01 whereby:01 compiler:01 inference:01 o'caml:01 blog:98 blog:98 wrote:01 wrote:01 exception:01 exception:01 caml-list:01 exceptions:01 exceptions:01 argument:02 On Sun, Dec 10, 2006 at 06:27:37PM -0500, Chris King wrote: > On 12/10/06, Richard Jones wrote: > >On Sat, Dec 09, 2006 at 10:35:56PM -0500, Chris King wrote: > >> One thing Java (sort of) gets right is keeping track of which > >> exceptions a function can throw, making it easy to ensure that some > >> deeply nested piece of code won't cause the entire application to die > >> from some obscure exception. I'd love to see a similar feature in > >> O'Caml, whereby the exceptions which a function can raise are part of > >> its type and are inferred and checked by the compiler. > > > >Oh please no! Checked exceptions are the dumbest and most frustrating > >feature of Java (and that's saying something - the Java language has > >far more frustrations than most programming languages). I'll moderate what I said before by adding that I now think there are some exceptions which should never be ignored - for example, it seems like it's always a mistake to ignore Not_found or End_of_file. On the other hand I would almost always want to ignore Sys_error, or else catch it far away from its point of origin in a wrapper around the whole program or an event handler. Perhaps though this is an argument that List.find and friends should be returning 'a option, not an argument for all exceptions being bad. > I fully agree. Forcing the programmer to acknowledge the presence of > every possible exception is annoying to write and makes for fragile > code. Hence I suggested exception inference... no extra effort is > required on the part of the programmer and the code is not made > fragile. O'Caml provides the safety of checked types without the > hassle of type declarations; in the same way it could provide the > safety of checked exceptions without the hassle of exception > declarations. Agreed. I'd like to see a detailed prototype. Rich. --=20 Richard Jones, CTO Merjis Ltd. Merjis - web marketing and technology - http://merjis.com Internet Marketing and AdWords courses - http://merjis.com/courses - NEW! Merjis blog - http://blog.merjis.com - NEW!