From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 11564BC57 for ; Thu, 27 May 2010 11:19:57 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AskDAOLV/UtRZ90vkWdsb2JhbACDF5sBFQEBAQEJCwoHEQMfryCRCYElgwRqBA X-IronPort-AV: E=Sophos;i="4.53,310,1272837600"; d="scan'208";a="60119775" Received: from mtaout01-winn.ispmail.ntl.com ([81.103.221.47]) by mail1-smtp-roc.national.inria.fr with ESMTP; 27 May 2010 11:19:50 +0200 Received: from aamtaout03-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20100527091949.CROO14666.mtaout01-winn.ispmail.ntl.com@aamtaout03-winn.ispmail.ntl.com>; Thu, 27 May 2010 10:19:49 +0100 Received: from romulus.metastack.com ([81.102.132.77]) by aamtaout03-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20100527091949.LDAE1598.aamtaout03-winn.ispmail.ntl.com@romulus.metastack.com>; Thu, 27 May 2010 10:19:49 +0100 Received: from Tenor ([212.183.140.35]) (authenticated bits=0) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id o4R9Jd19014297 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Thu, 27 May 2010 10:19:44 +0100 From: "David Allsopp" To: "=?utf-8?Q?'Daniel_B=C3=BCnzli'?=" , References: <956439.81564.qm@web111506.mail.gq1.yahoo.com> <4BFE2881.1070705@imag.fr> <000c01cafd7a$3f6595e0$be30c1a0$@romulus.metastack.com> In-Reply-To: Subject: RE: [Caml-list] Static exception analysis or alternative to using exceptions Date: Thu, 27 May 2010 10:19:39 +0100 Message-ID: <001501cafd7d$bf138fb0$3d3aaf10$@romulus.metastack.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQIBUroxhHU31Hf1sNIRcTuhV5nPKgI6/bv5Ah5T7dsDCni87wHoK2MsAt1+FjADdKdpcg== 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=VZGMvYHv9TIA:10 a=8sW17jYxVu0A:10 a=IkcTkHD0fZMA:10 a=pGnXrFKX_xHZyv-xBQwA:9 a=tsKVYsz2Ljm7vHSYvgjCBdsWq0wA:4 a=QEXdDO2ut3YA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 X-Spam: no; 0.00; hashtbl:01 wrote:01 naming:01 exception:01 exception:01 caml-list:01 exceptions:01 exceptions:01 argument:02 static:03 library:03 raise:03 daniel:04 exists:05 discussion:06 Daniel B=C3=BCnzli wrote: > > 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. >=20 > In that case what you want is an alternate function "really_find" that > doesn't raise Not_found but Invalid_argument if the key cannot be = found. Absolutely - but the point is that there is an obvious need to have the = exception vs 'a option versions of the function. Appropriate naming of = exceptions in the standard library is a well-rehearsed discussion :o) David