From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 8BC0FBC57 for ; Wed, 26 May 2010 19:30:43 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgQEALP3/EtDww+jdWdsb2JhbACDF4UuiRqDL4khARcgBR+xOzmCAYVHiH0BBAQBgSCDBGoEg0I X-IronPort-AV: E=Sophos;i="4.53,304,1272837600"; d="scan'208";a="51259385" Received: from web111506.mail.gq1.yahoo.com ([67.195.15.163]) by mail3-smtp-sop.national.inria.fr with SMTP; 26 May 2010 19:30:42 +0200 Received: (qmail 85249 invoked by uid 60001); 26 May 2010 17:30:41 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1274895040; bh=AxAG9BOuZxxaYV2mC7//BFL6kZ4v9DdJJYoocepMjn4=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding; b=v1zhxxzfnr9hFmBtdUaJEoZQycEP46rRt/Axa9lBN/+Ms0zZP07gQ4AlaSa9E/MdYyou8HMLou0zdogUBxjm6ffRyKOh8n0uFVcvEOCJzN/0yg7/CeQVYxqrjlCHXRloekXXgzU31qxFvt1M0nDDL0HReS14lQvA0QA6xirEbR0= 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:MIME-Version:Content-Type:Content-Transfer-Encoding; b=iqNdi+PYGVC3eDPSe2Nn0JDMjyxCm7FTBQkn3ZhPAdGInSLCJvCIysza44/Tn3yKdCtjdk0MkB+MPNhg3K8+INn6oVYsP1uma2kVZOEowkuqIxs2u6O1rIA8cjiAm3/0zfGF3VENt7BdBw6qzQBztGqRmeZoWI7JswSO8o8HUUs=; Message-ID: <956439.81564.qm@web111506.mail.gq1.yahoo.com> X-YMail-OSG: jDRGZckVM1mCQb6_mDBqb75CCMl0uL6i8NTt7jVla4FY.Z_ IccCZeAUkqRgu4rWbET.PJo.kDVHfkc8jFBKV7FOFkiTuAXvRQS.YrCxzxd_ sJci5S6D.3McAd9aaScs80izPT_p2PCtLRdeZi4MbQwVoG3ztL89N7963ZR4 9R_fhjkSy6DMC_H93sBohWuWkmvsbS.Rw5CzP9eRsHodsEa.y5NXOquBnKkH gluOA7SjClxaN0QgfU9PQAOSYYi2ouyQB6rIAHB4TdQjT7wSiutiBpJoMdjL tQdQZS0HpNJG8Jv.tSFLZzyQSbWG6mDCrPeIh4G.OOfFpxUd64RK6O1U04Wk 6OAfEUtyRBAPyDuNiTRxc2ERW1TYmQyJy Received: from [213.205.71.59] by web111506.mail.gq1.yahoo.com via HTTP; Wed, 26 May 2010 10:30:40 PDT X-Mailer: YahooMailClassic/11.0.8 YahooMailWebService/0.8.103.269680 Date: Wed, 26 May 2010 10:30:40 -0700 (PDT) From: Dario Teixeira Subject: Re: [Caml-list] Static exception analysis or alternative to using exceptions To: Hans Ole Rafaelsen Cc: caml-list@yquem.inria.fr MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; monads:01 ocaml:01 runtime:01 stdlib:01 invoke:01 exception:01 exception:01 caml-list:01 functions:01 functions:01 exceptions:01 exceptions:01 explicitly:02 btw:03 seems:03 Hi,=0A=0A> What experience does people have to using alternatives to except= ions,=0A> such as option types or exception monads? Does use of third part= =0A> libraries that still throws exceptions make such approaches hard to us= e?=0A> Performance wise it seems to be comparable to catching exceptions or= =0A> matching for options, so I guess the difference be might a question of= =0A> programming style?=0A=0APartly yes, though I would say that in Ocaml i= t is tempting to use=0Aexceptions beyond what is reasonable, because they a= re so cheap and=0Aconvenient. As you noted, this can lead to trouble at ru= ntime, which=0Ais why some libraries discourage the "exceptional style", pr= eferring=0Aoption types and forcing users to invoke functions suffixed by "= _exc"=0Aif they really want to use the exception-based version.=0A=0APerson= ally, I think the litmus test hinges on whether the supposedly=0Aexceptiona= l situation is truly worthy of the name. If it's a common=0Aoccurrence, pe= rhaps one should reconsider the use of an "exception".=0AWithout meaning to= start an holy war, let me just add that even on=0Athe Stdlib there are fun= ctions (such as Map.S.find) that raise an=0Aexception but which should perh= aps return an option type.=0A=0ABtw, you didn't mention it explicitly in yo= ur message, but I trust you=0Aare familiar with "Catch me if you can"? [1]= =0A=0ABest regards,=0ADario Teixeira=0A=0A[1] http://dutherenverseauborddel= atable.wordpress.com/downloads/exception-monads-for-ocaml/=0A=0A=0A=0A =