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=1.3 required=5.0 tests=AWL,HTML_MESSAGE,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 102BFBC6C for ; Fri, 1 Feb 2008 13:19:16 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAD6dokfAXQImh2dsb2JhbACCOzWNNAEBAQgKKZcThiA X-IronPort-AV: E=Sophos;i="4.25,290,1199660400"; d="scan'208";a="7511974" Received: from discorde.inria.fr ([192.93.2.38]) by mail1-smtp-roc.national.inria.fr with ESMTP; 01 Feb 2008 13:19:16 +0100 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m11CJFTd015952 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Fri, 1 Feb 2008 13:19:15 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAMecokfRVca+k2dsb2JhbACCOzWNNAEBAQEHAgYLCBaXE4Yg X-IronPort-AV: E=Sophos;i="4.25,290,1199660400"; d="scan'208";a="22053323" Received: from rv-out-0910.google.com ([209.85.198.190]) by mail4-smtp-sop.national.inria.fr with ESMTP; 01 Feb 2008 13:19:14 +0100 Received: by rv-out-0910.google.com with SMTP id g11so718615rvb.57 for ; Fri, 01 Feb 2008 04:19:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; bh=n95QHxPuA6nyqy9KE2CfpBpAdJW+413E1ebbuRLmSEQ=; b=stdFFhl9qgDgTHKELhYWnPWlcCrkqefDvmIk0WHk/IgCHE2GJbvJxw6zj4PS2x28+KmIQA7lofeVOwbUJCQs34dmTSOBnwpzaFftPRbLbadVuB8yC1oeE034+HG29ydYpZQbysMoXAsxGPaPbz+5vJ+xPi6xyxdxOAbKYEZpqRw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; b=awbiU/fOoxAP8QJ+oVJ5q3gU4ZIq06Fu4GiUl41MU1TGgpoKRKqkjICylHwSm9YE3JGerNbnsjEbO9jryWdmEGsIhhIXUOn0G5MxS0WZNhy0mMwP6aS7+QsFuaJOHO1x/qPqp3qjf/dnb81iizSOsLw5rm4K+5GHF11AXg/kNB4= Received: by 10.140.207.3 with SMTP id e3mr2419092rvg.262.1201868353299; Fri, 01 Feb 2008 04:19:13 -0800 (PST) Received: by 10.141.12.14 with HTTP; Fri, 1 Feb 2008 04:19:13 -0800 (PST) Message-ID: <891bd3390802010419t333d3a33n719de5fc56e3e097@mail.gmail.com> Date: Fri, 1 Feb 2008 07:19:13 -0500 From: "Yaron Minsky" Reply-To: yminsky@gmail.com To: "David Teller" Subject: Re: [Caml-list] [OSR] Exceptionless error management Cc: "=?ISO-8859-1?Q?B=FCnzli_Daniel?=" , "caml-list List" In-Reply-To: <1201854718.6516.4.camel@Blefuscu> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_27611_18720918.1201868353264" References: <1201854718.6516.4.camel@Blefuscu> X-Miltered: at discorde with ID 47A30E43.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; yaron:01 minsky:01 yminsky:01 exn:01 monadic:01 monads:01 beginner's:01 ocaml:01 bug:01 exn:01 monadic:01 monads:01 beginner's:01 ocaml:01 bug:01 ------=_Part_27611_18720918.1201868353264 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline We've come to be pretty leery of exceptions at Jane Street, and we've had some experience trying to control their use Some quick observations on the current proposal: 1. Banning exceptions outright seems too strict. Our tendency has been to have two versions of the function, e.g., Map.find and Map.find_exn. (Our previous approach would have been to use Map.find_opt for the one that returns and option and Map.find for the exception-throwing one, but we're slowly migrating to the first proposal.) The goal is to make the user aware that an exception is reasonably likely, rather than ban exceptions. 2. We've played around with monadic error systems that combine errors into a big polymorphic variant. The key practical problem we hit were obscenely complicated error messages. Still, in some cases, monads are very nice. 3. Having a variant type other than option so you can specify various different errors (ours is Ok of 'a | Error of 'b) is a good idea. And I think it's common enough that you should define it in your core library as an ordinary variant and make it available everywhere. y > > _______________________________________________ > 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 > ------=_Part_27611_18720918.1201868353264 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline We've come to be pretty leery of exceptions at Jane Street, and we've had some experience trying to control their use  Some quick observations on the current proposal:
  1. Banning exceptions outright seems too strict.  Our tendency has been to have two versions of the function, e.g., Map.find and Map.find_exn.  (Our previous approach would have been to use Map.find_opt for the one that returns and option and Map.find for the exception-throwing one, but we're slowly migrating to the first proposal.)  The goal is to make the user aware that an exception is reasonably likely, rather than ban exceptions.
  2. We've played around with monadic error systems that combine errors into a big polymorphic variant.  The key practical problem we hit were obscenely complicated error messages.  Still, in some cases, monads are very nice.
  3. Having a variant type other than option so you can specify various different errors (ours is Ok of 'a | Error of 'b) is a good idea.  And I think it's common enough that you should define it in your core library as an ordinary variant and make it available everywhere.
y



_______________________________________________

------=_Part_27611_18720918.1201868353264--