From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id BD248BC57 for ; Thu, 27 May 2010 10:08:38 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah4FALfF/UuBWB4FgWdsb2JhbACIRYkWjFIBARYiIr9whRME X-IronPort-AV: E=Sophos;i="4.53,310,1272837600"; d="scan'208";a="51913498" Received: from mx1.imag.fr (HELO shiva.imag.fr) ([129.88.30.5]) by mail2-smtp-roc.national.inria.fr with ESMTP; 27 May 2010 10:08:38 +0200 Received: from rhin.imag.fr (rhin.imag.fr [147.171.129.2]) by shiva.imag.fr (8.13.8/8.13.8) with ESMTP id o4R81VDh018184 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 27 May 2010 10:01:31 +0200 Received: from [147.171.129.114] (prahova.imag.fr [147.171.129.114]) by rhin.imag.fr (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id o4R88Xbj022795 for ; Thu, 27 May 2010 10:08:34 +0200 Message-ID: <4BFE2881.1070705@imag.fr> Date: Thu, 27 May 2010 10:08:33 +0200 From: Florent Ouchet Organization: Tima/CIS User-Agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103) MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Static exception analysis or alternative to using exceptions References: <956439.81564.qm@web111506.mail.gq1.yahoo.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0.1 (shiva.imag.fr [129.88.30.5]); Thu, 27 May 2010 10:01:31 +0200 (CEST) X-IMAG-MailScanner-Information: Please contact MI2S MIM for more information X-MailScanner-ID: o4R81VDh018184 X-IMAG-MailScanner: Found to be clean X-IMAG-MailScanner-SpamCheck: X-IMAG-MailScanner-From: florent.ouchet@imag.fr MailScanner-NULL-Check: 1275552095.59286@GauhXa8ftX8zWHCkz1nOUQ X-Spam: no; 0.00; rafaelsen:01 monads:01 ocaml:01 runtime:01 stdlib:01 syntax:01 beginner's:01 ocaml:01 bug:01 beginner's:01 bug:01 tima:01 26,:98 26,:98 invoke:01 Hello, Same here, specially to avoid the Not_found exception. The optional return values gives the oportunity to have a clear view of what is being done if the result is not available. - Florent Jacques Le Normand a écrit : > Jane Street's Core seems to prefer options to exceptions > > On Wed, May 26, 2010 at 5:10 PM, Hans Ole Rafaelsen > > wrote: > > > > On Wed, May 26, 2010 at 7:30 PM, Dario Teixeira > > wrote: > > Hi, > > > What experience does people have to using alternatives to > exceptions, > > such as option types or exception monads? Does use of third part > > libraries that still throws exceptions make such approaches > hard to use? > > Performance wise it seems to be comparable to catching > exceptions or > > matching for options, so I guess the difference be might a > question of > > programming style? > > Partly yes, though I would say that in Ocaml it is tempting to use > exceptions beyond what is reasonable, because they are so > cheap and > convenient. As you noted, this can lead to trouble at > runtime, which > is why some libraries discourage the "exceptional style", > preferring > option types and forcing users to invoke functions suffixed by > "_exc" > if they really want to use the exception-based version. > > Personally, I think the litmus test hinges on whether the > supposedly > exceptional situation is truly worthy of the name. If it's a > common > occurrence, perhaps one should reconsider the use of an > "exception". > Without meaning to start an holy war, let me just add that even on > the Stdlib there are functions (such as Map.S.find) that raise an > exception but which should perhaps return an option type. > > Btw, you didn't mention it explicitly in your message, but I > trust you > are familiar with "Catch me if you can"? [1] > > I have just read about it, not tested it yet. Do you have any > experience using this library, especially together with other > libraries that also provides syntax extension? > > > > Best regards, > Dario Teixeira > > [1] > http://dutherenverseauborddelatable.wordpress.com/downloads/exception-monads-for-ocaml/ > > > > > Thanks, > > Hans Ole > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > > > ------------------------------------------------------------------------ > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > -- Florent Ouchet PhD Student CIS/VDS Team - TIMA Laboratory