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=0.0 required=5.0 tests=AWL 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 68746BBAF for ; Fri, 21 Nov 2008 10:53:03 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqsAAJETJknBvsFKmWdsb2JhbACTWQEBAQEBCAsKBxG/PIJ8 X-IronPort-AV: E=Sophos;i="4.33,639,1220220000"; d="scan'208";a="20213043" Received: from dnsp.umh.ac.be (HELO hermes1.umh.ac.be) ([193.190.193.74]) by mail1-smtp-roc.national.inria.fr with ESMTP; 21 Nov 2008 10:53:03 +0100 Received: from poincare.swapping.umh.ac.be ([10.102.100.10]) by hermes1.umh.ac.be (8.14.2/8.13.6) with ESMTP id mAL9pQQv475372; Fri, 21 Nov 2008 10:51:26 +0100 Received: from localhost ([127.0.0.1] ident=trch) by poincare.swapping.umh.ac.be with esmtp (Exim 4.69) (envelope-from ) id 1L3Sgd-0001d4-3x; Fri, 21 Nov 2008 10:52:27 +0100 Date: Fri, 21 Nov 2008 10:52:26 +0100 (CET) Message-Id: <20081121.105226.145593194798154995.Christophe.Troestler+ocaml@umh.ac.be> To: eliot@colba.net Cc: OCaml Mailing List Subject: Re: [Caml-list] Stability of exceptions From: Christophe TROESTLER In-Reply-To: <49262360.7040807@colba.net> References: <1227188375-sup-8502@ausone.inria.fr> <20081120164406.GA6980@usha.takhisis.invalid> <49262360.7040807@colba.net> X-Face: #2fb%mPx>rRL@4ff~TVgZ"<[:,oL"`TUEGK/[8/qb58~C>jR(x4A+v/n)7BgpEtIph_neoLKJBq0JBY9:}8v|j Organization: University of Mons-Hainaut X-Mailer: Mew version 6.0.51 on Emacs 22.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 193.190.193.76 X-Spam: no; 0.00; christophe:01 troestler:01 christophe:01 troestler:01 ocaml:01 cheers:01 imho:01 wrote:01 caml-list:01 exceptions:01 umh:01 strings:01 argument:02 argument:02 bounds:02 On Thu, 20 Nov 2008 21:56:32 -0500, Eliot Handelman wrote: > > let test i = > try > [||].(i) > with > Invalid_argument "index out of bounds" -> raise (Array_access i) > > > The problem is that this test is dependent on a literal string match of > "index out of bounds." If > I accidentally write something like "index out out bounds" (an extra > space between index & out) These strings are for user information, you should write let test i = try [||].(i) with Invalid_argument _ -> raise (Array_access i) IMHO, in this case, you should rather make sure you do not perform accesses outside the array bounds. Cheers, ChriS