From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr 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 A911CBC57 for ; Thu, 27 May 2010 10:54:51 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AskDAEPQ/UtRZ90wkWdsb2JhbACeGBUBAQEBCQsKBxEDH8AxhRME X-IronPort-AV: E=Sophos;i="4.53,310,1272837600"; d="scan'208";a="51917445" Received: from mtaout02-winn.ispmail.ntl.com ([81.103.221.48]) by mail2-smtp-roc.national.inria.fr with ESMTP; 27 May 2010 10:54:51 +0200 Received: from aamtaout04-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20100527085450.PQBW10460.mtaout02-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com>; Thu, 27 May 2010 09:54:50 +0100 Received: from romulus.metastack.com ([81.102.132.77]) by aamtaout04-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20100527085450.BRQP1593.aamtaout04-winn.ispmail.ntl.com@romulus.metastack.com>; Thu, 27 May 2010 09:54:50 +0100 Received: from Tenor ([212.183.140.35]) (authenticated bits=0) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id o4R8sUg3014041 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Thu, 27 May 2010 09:54:40 +0100 From: "David Allsopp" To: "'Florent Ouchet'" , References: <956439.81564.qm@web111506.mail.gq1.yahoo.com> <4BFE2881.1070705@imag.fr> In-Reply-To: <4BFE2881.1070705@imag.fr> Subject: RE: [Caml-list] Static exception analysis or alternative to using exceptions Date: Thu, 27 May 2010 09:54:29 +0100 Message-ID: <000c01cafd7a$3f6595e0$be30c1a0$@romulus.metastack.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQIBUroxhHU31Hf1sNIRcTuhV5nPKgI6/bv5Ah5T7dsDCni87wHoK2Ms Content-Language: en-gb Organization: MetaStack Solutions Ltd. X-Scanned-By: MIMEDefang 2.65 on 81.102.132.77 X-Cloudmark-Analysis: v=1.1 cv=ZtHxNT4mZm3rCuM0SmWmgWxeBwJsziC8EqOrwwVkrhA= c=1 sm=0 a=TkWsxXdVWLYA:10 a=Lw_SFsgOoS4A:10 a=8sW17jYxVu0A:10 a=kj9zAlcOel0A:10 a=4_0Yma8pdZ_nmy8STiMA:9 a=7G3Op5fPxr4E-5HzM8MA:7 a=W5QCYjlx_W1uCh2dOKaiYSmNDk0A:4 a=CjuIK1q_8ugA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 X-Spam: no; 0.00; hashtbl:01 wrote:01 exception:01 exception:01 caml-list:01 exceptions:01 static:03 exists:05 exc:07 examples:07 space:07 boxing:08 optional:09 passes:10 analysis:11 Florent Ouchet wrote: > 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. Agreed - though [find] is one of the examples where you do need find and find_exc - because often there are occasions where before calling {Map,Set,Hashtbl}.find you already know that the key exists and so won't fail at which point the 'a option boxing is a waste of time and space and Not_found would be a truly exceptional situation so passes the previously mentioned test. David