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=3.0 required=5.0 tests=AWL,DNS_FROM_RFC_POST, 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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 57271BBAF for ; Fri, 21 Nov 2008 08:40:47 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmICACf0JUnAXQIngWdsb2JhbACTGz4BARYiszSLJAEDAQOCeYIQ X-IronPort-AV: E=Sophos;i="4.33,639,1220220000"; d="scan'208";a="19403080" Received: from concorde.inria.fr ([192.93.2.39]) by mail3-smtp-sop.national.inria.fr with ESMTP; 21 Nov 2008 08:40:46 +0100 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id mAL7ejVW018520 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Fri, 21 Nov 2008 08:40:46 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: At4AABz1JUlIDtyZimdsb2JhbACTGz4BAQEKCQwHDwWzOoslAQMBA4J5ghA X-IronPort-AV: E=Sophos;i="4.33,639,1220220000"; d="scan'208";a="31675051" Received: from fg-out-1718.google.com ([72.14.220.153]) by mail4-smtp-sop.national.inria.fr with ESMTP; 21 Nov 2008 08:40:33 +0100 Received: by fg-out-1718.google.com with SMTP id e21so630888fga.25 for ; Thu, 20 Nov 2008 23:40:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer:sender; bh=+zCvkYTK+j59X+ucip+4pD0j09gSCULQcuO9L0viKgw=; b=gNiXzKSuTrFhpHpPZCECUb/mOx+shiuYAm4QImdhSou1a+lFerXzMBYO1ZjR7UcLnU CpJMM/Bq31stcjNJJP5A0PNTYheoD/WjO1x3afOM0bADA/FP27tcpL7NUiIXMxLuOXbC k22XepK0gZm6pQgtwGX5Nhjxm9xElOvXG3rBE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer:sender; b=gf3jweKtiUZmE/nnsZ3deJ3k4W8feGkjyhzJ7782MynzXAXgXnKzLPrYSqD1DFm21N XvLx7kBEFaql1r8OZEySiCkzUfwfgrBYgceSY+hENR4RvoO6qHVquTttiSvWfMXur40c c2fP/HBUDPed2L9qJ1enUK1mNNB8iRzCLQmao= Received: by 10.86.62.3 with SMTP id k3mr131452fga.46.1227253232825; Thu, 20 Nov 2008 23:40:32 -0800 (PST) Received: from ?192.168.1.34? (71-10.76-83.cust.bluewin.ch [83.76.10.71]) by mx.google.com with ESMTPS id e20sm3552648fga.1.2008.11.20.23.40.31 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 20 Nov 2008 23:40:32 -0800 (PST) Message-Id: <6B2DB6BC-0839-439D-BB8F-5A1356C78D2E@erratique.ch> From: =?ISO-8859-1?Q?Daniel_B=FCnzli?= To: OCaml List In-Reply-To: <49262360.7040807@colba.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v929.2) Subject: Re: [Caml-list] Stability of exceptions Date: Fri, 21 Nov 2008 08:39:29 +0100 References: <200811182330.03947.jon@ffconsultancy.com> <1227076192.6290.7.camel@Blefuscu> <4b5157c30811190146l2c6a5e2cv4a085bcc14ae5f4@mail.gmail.com> <20081119211124.51610ae9@alcazar.inria.fr> <1227172839-sup-5973@ausone.inria.fr> <20081120103303.GA25346@annexia.org> <20081120104914.GA14355@usha.takhisis.invalid> <000001c94b03$4f55d4e0$ee017ea0$@com> <1227185953-sup-4761@ausone.inria.fr> <1227188375-sup-8502@ausone.inria.fr> <20081120164406.GA6980@usha.takhisis.invalid> <49262360.7040807@colba.net> X-Mailer: Apple Mail (2.929.2) Sender: =?UTF-8?B?RGFuaWVsIELDvG56bGk=?= X-Miltered: at concorde with ID 492665FD.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; bunzli:01 buenzli:01 buffer:01 buffer:01 ocaml:01 literals:01 compile:01 exception:01 caml-list:01 caml-list:01 exceptions:01 exceptions:01 unsafe:01 caml:02 argument:02 Le 21 nov. 08 =E0 03:56, Eliot Handelman a =E9crit : > In order to catch array access violations, Don't do that. This was already raised on the list but I cannot find =20 the reference anymore. One argument that comes to mind is if one day =20 you need optimal performance you won't be able to compile with -=20 unsafe. Invalid_argument exceptions are programming errors and usually =20= you should not try to catch them [1]. > My problem is not confined to this particular case I agree, the problem also exists with Failure and I already =20 encountered it (full Buffer). In that case the safest route is to wrap =20= with a handler the greatest body of code that you know can only raise =20= Failure because of the particular condition you try to catch and raise =20= your own exception on any Failure (see for example the module Buffer =20 at the very end of this file [2]). > Would it not be better for Ocaml to have built-in exceptions (not =20 > string literals) for things of this importance? Of course it would. Best, Daniel [1] = http://caml.inria.fr/pub/ml-archives/caml-list/2007/10/e6683fd700e87f214c7= 57ecaaa4f8ede.fr.html [2] http://erratique.ch/software/xmlm/repo/src/xmlm.ml