From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 848CEBC57 for ; Thu, 27 May 2010 23:13:32 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AisCAP98/ktDww/Hi2dsb2JhbACRZoMyiSEBAQEKCwoHDwUfsRmCAYVaiH0BBAQBhQ4Eg0I X-IronPort-AV: E=Sophos;i="4.53,313,1272837600"; d="scan'208";a="63542530" Received: from web111512.mail.gq1.yahoo.com ([67.195.15.199]) by mail4-smtp-sop.national.inria.fr with SMTP; 27 May 2010 23:13:31 +0200 Received: (qmail 22972 invoked by uid 60001); 27 May 2010 21:13:30 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1274994810; bh=kthBWVELmtlpjsX0hLB6PBJBkD3zzfL54ANqDqWBzBA=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=Mtt9Yzn0WnCVgV6tuzMYUNxVvCCzArHSF2kwhR12ySoVNC+7r6cOOJ4jZCBkZJNmUWTOjbHFQg4K0pX0q/x9i4bO7/oss5zoYydM9YBpAFiJBNDchgQUvlrLC3nsEdLRQSSlltMck/M1wyfTGjCtJtZzhVG5EDvRDGQXSAC8tM4= DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=WnLNlACBP3poYbfPtEWtFF/DtY5MPvCnAD7cqB679RPq3MnaAiDWbwoNl6q6oQicvDU1dIFBMzyiL7HMCDDG8R/qSbj30pzZIE5u1VDZ0VnWfif9GCkpG+SdoBBabnMNa5Yp4RD6fu9yQ7oGEqvAby9RV+QZ9+LQMqCf75fSuG0=; Message-ID: <263033.22957.qm@web111512.mail.gq1.yahoo.com> X-YMail-OSG: hwR0LGUVM1n62VxHVNI7an6WuHGmLbuM66h4pthBOu7.K6. 0HaLaOA0xSofxiCdz_vHe84hMDfALjPx8wjIwPe3yqhJZI0mcKSyJtLiF3_h OS6EOAlwo4hxVIPDx.K9cDSLTIC2hc78CD1veCKcjmq_NmulMPLaHTXQb7HO VC7Gd_bbQbR1opvx2CX3feKaNieY8BdDHflu3LUe55oPZPEwiaj0FqiTfyLG Pm7pAzpRx1URQfc8IwuvwHC_XaA3HkyCZxOwiPh9e4yMd7etpmZu3Rej8XyA J6moywO7u_RrZ97uVmnQw.rA1J17O1eDTKnWP61w4 Received: from [213.205.71.57] by web111512.mail.gq1.yahoo.com via HTTP; Thu, 27 May 2010 14:13:29 PDT X-Mailer: YahooMailClassic/11.0.8 YahooMailWebService/0.8.103.269680 Date: Thu, 27 May 2010 14:13:29 -0700 (PDT) From: Dario Teixeira Subject: Re: [Caml-list] Static exception analysis or alternative to using exceptions To: Hans Ole Rafaelsen , Richard Jones Cc: caml-list@inria.fr In-Reply-To: <20100527170122.GA28273@annexia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; stdlib:01 invocation:01 cheers:01 exception:01 exception:01 caml-list:01 functions:01 functions:01 exceptions:01 exceptions:01 bears:02 static:03 raise:03 lookup:07 programmer:07 Hi,=0A=0A> Personally I've found that you should only throw those exception= s=0A> which can be caught in a single place in the program.=A0 By this I me= an=0A> that an exception such as Not_found shouldn't be thrown, and instead= =0A> it would be better to use an option type (for stdlib functions which= =0A> throw Not_found, you have to be _very_ careful that the exception=0A> = cannot "escape").=0A=0AYes, I agree. As an illustration, dictionary lookup= functions such as=0AMap.find should return an option type, but use excepti= ons for truly=0Aexceptional circumstances that no sane programmer should ha= ve to watch=0Afor at every single invocation (say, "raise Dictionary_eaten_= by_bears").=0A=0ACheers,=0ADario Teixeira=0A=0A=0A=0A