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 79007BC57 for ; Thu, 27 May 2010 05:37:53 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmQDAH+F/UtKfVI0mGdsb2JhbACIRYkkMIwFCBUBAQEBAREMBxEisA6CAYVCLohPAQEDBYUOBA X-IronPort-AV: E=Sophos;i="4.53,308,1272837600"; d="scan'208";a="51274963" Received: from mail-ww0-f52.google.com ([74.125.82.52]) by mail3-smtp-sop.national.inria.fr with ESMTP; 27 May 2010 05:37:53 +0200 Received: by wwg30 with SMTP id 30so507146wwg.39 for ; Wed, 26 May 2010 20:37:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=YIjCJ28gPFcZGYzu+TneMyC7XnyOy5mJEUXEdRelh9o=; b=S9NHAdcJ9DTr38JhEslSf1zFjn5QlSkcer2OBjgai0wyCRGvTC0jEBYA5NoVS4PzAO 8L4Rz1YXRP9nQYdY/U5J2vnIabO4cb4tEQjVZV3XV/wmMphB9Qq+qJuB7alwMNhIfSNA sRNZ8vITs1WO1IDvcyDi+NrfkcwgqGGx5VMY8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=c8vrjmMTqIYVkbgIZBzYBKIY82E8B9I8F6eyBBaVz06XLx2ishg+RlLwOHyo8XU2lK vDIwzqvubnQ9Z4fofpIakMiePvdEhumxL468ACuWpX/XhKoeeSaDYpnZwVHQq3Sb06A8 V4iFUEDU/cGNBizCNdFCyn3U4qh0SS83frmfI= MIME-Version: 1.0 Received: by 10.216.85.68 with SMTP id t46mr263520wee.75.1274931472318; Wed, 26 May 2010 20:37:52 -0700 (PDT) Received: by 10.216.27.72 with HTTP; Wed, 26 May 2010 20:37:52 -0700 (PDT) In-Reply-To: References: <956439.81564.qm@web111506.mail.gq1.yahoo.com> Date: Wed, 26 May 2010 23:37:52 -0400 Message-ID: Subject: Re: [Caml-list] Static exception analysis or alternative to using exceptions From: Jacques Le Normand To: Hans Ole Rafaelsen Cc: Dario Teixeira , caml-list@yquem.inria.fr Content-Type: multipart/alternative; boundary=0016e6d645a885417e04878b1d81 X-Spam: no; 0.00; rafaelsen:01 monads:01 ocaml:01 runtime:01 stdlib:01 syntax:01 beginner's:01 ocaml:01 bug:01 rafaelsen:01 monads:01 runtime:01 stdlib:01 syntax:01 beginner's:01 --0016e6d645a885417e04878b1d81 Content-Type: text/plain; charset=ISO-8859-1 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 > > --0016e6d645a885417e04878b1d81 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Jane Street's Core seems to prefer options to exceptions

On Wed, May 26, 2010 at 5:10 PM, Hans Ole Rafaelsen <hrafaelsen@gmail= .com> wrote:


On Wed, May 26, 2010 at 7:30 PM, Dario Teixeira <darioteix= eira@yahoo.com> wrote:
Hi,

> What experience does people have to using alternatives to exceptions,<= br> > such as option types or exception monads? Does use of third part
> libraries that still throws exceptions make such approaches hard to us= e?
> 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. =A0As you noted, this can lead to trouble at runtime, which
is why some libraries discourage the "exceptional style", preferr= ing
option types and forcing users to invoke functions suffixed by "_exc&q= uot;
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. =A0If it's a common<= br> occurrence, perhaps one should reconsider the use of an "exception&quo= t;.
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<= br> are familiar with "Catch me if you can"? [1]
I have just read about it, not tested it yet. Do you have any experi= ence using this library, especially together with other libraries that also= provides syntax extension?
=A0
Thanks,

Hans Ole

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.in= ria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


--0016e6d645a885417e04878b1d81--