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 594AEBC57 for ; Thu, 27 May 2010 11:12:20 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiQFAMbU/UvRVdvdemdsb2JhbACDF45zjAYIFQEBFCQDH68hgjqFT4h9AQEDBYEggwRqBI1p X-IronPort-AV: E=Sophos;i="4.53,310,1272837600"; d="scan'208";a="60118823" Received: from mail-ew0-f221.google.com ([209.85.219.221]) by mail1-smtp-roc.national.inria.fr with ESMTP; 27 May 2010 11:12:20 +0200 Received: by ewy21 with SMTP id 21so1404773ewy.7 for ; Thu, 27 May 2010 02:12:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=5LbYUbiMHy9kY2T5VIRO/LiRDdaRP6kIbb2zsYag6Jo=; b=Lwj7EC4GNyrYwL8/O7DocRCABZm6tDhAnGqfet9j6cND3fGhRPfCjHwb6KnJ7fOWFZ H20VAF5BlWkggPdaoQFlXt7UVMd2jqQhd5H/USGlhEz3msr8DTA/2G6oi4xmbyItPNB/ l3A86DG6ND+D80ndh3d35QXUa7m8w67eZbTpQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=Hccliukv3iIvhuiQPozQ23I0O75iMx9UhyzuMUwghSXexbuAorQalC0oqCzWitsfpL xaLE2MrEonAbnXszgYS/Lfe2ABRe9RCbH6/AKfBnq4LkRfWeGEm08PKeyxEO9Wjnf/H4 78CFIArzd46RupTn1R47SShuVeUsPVb8ekn3c= MIME-Version: 1.0 Received: by 10.213.29.210 with SMTP id r18mr1939815ebc.20.1274951539436; Thu, 27 May 2010 02:12:19 -0700 (PDT) Sender: daniel.c.buenzli@gmail.com Received: by 10.213.14.141 with HTTP; Thu, 27 May 2010 02:12:19 -0700 (PDT) In-Reply-To: <000c01cafd7a$3f6595e0$be30c1a0$@romulus.metastack.com> References: <956439.81564.qm@web111506.mail.gq1.yahoo.com> <4BFE2881.1070705@imag.fr> <000c01cafd7a$3f6595e0$be30c1a0$@romulus.metastack.com> Date: Thu, 27 May 2010 11:12:19 +0200 X-Google-Sender-Auth: 4yxzoub7l3IGf6TWR_c8VxcoIgw Message-ID: Subject: Re: [Caml-list] Static exception analysis or alternative to using exceptions From: =?UTF-8?Q?Daniel_B=C3=BCnzli?= To: caml-list@yquem.inria.fr Content-Type: text/plain; charset=UTF-8 X-Spam: no; 0.00; buenzli:01 hashtbl:01 exception:01 caml-list:01 exceptions:01 argument:02 static:03 raise:03 daniel:04 daniel:04 exists:05 exc:07 examples:07 space:07 boxing:08 > 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. 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. Best, Daniel