From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 8E91DBC2F for ; Mon, 29 Nov 2004 18:04:34 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iATH4Yl9023900 for ; Mon, 29 Nov 2004 18:04:34 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA02686 for ; Mon, 29 Nov 2004 18:04:33 +0100 (MET) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id iATH4XZ0022407 for ; Mon, 29 Nov 2004 18:04:33 +0100 Received: from localhost (akasha.ijm.jussieu.fr [134.157.173.57]) by shiva.jussieu.fr (8.12.11/jtpda-5.4) with ESMTP id iATH4UdY052876 ; Mon, 29 Nov 2004 18:04:30 +0100 (CET) X-Ids: 165 Date: Mon, 29 Nov 2004 18:04:29 +0100 (CET) Message-Id: <20041129.180429.38700401.andrieu@ijm.jussieu.fr> To: rich@annexia.org Cc: caml-list@inria.fr Subject: Re: [Caml-list] Strange parsing of with-clauses From: Olivier Andrieu In-Reply-To: <20041129162640.GA27030@annexia.org> References: <20041129162640.GA27030@annexia.org> X-Mailer: Mew version 4.1 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.5.11 (shiva.jussieu.fr [134.157.0.165]); Mon, 29 Nov 2004 18:04:30 +0100 (CET) X-Miltered: at nez-perce with ID 41AB56A2.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 41AB56A1.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at shiva.jussieu.fr with ID 41AB569E.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Antivirus: scanned by sophie at shiva.jussieu.fr X-Spam: no; 0.00; caml-list:01 parsing:01 andrieu:01 andrieu:01 ijm:01 val:01 failwith:01 failwith:01 defines:01 exception:01 exception:01 polymorphic:01 strings:01 constructor:01 jussieu:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: Richard Jones [Mon, 29 Nov 2004]: > Not a big problem, but strange nevertheless: > > # exception E of string * string;; > exception E of string * string > # let f () = raise (E ("a", "b"));; > val f : unit -> 'a = > # try f (); failwith "Not found" with E (a,b) -> (a,b);; > - : string * string = ("a", "b") > # try f (); failwith "Not found" with E t -> t;; > --- > The constructor E expects 2 argument(s), but is here applied to 1 > argument(s) > > (In my actual code I want to return the thrown tuple to the > caller). Ah no, the issue is not with the `with' clause but with the exception definition. `E of string * string' defines an exception with two arguments of type string, which has a different representation than an exception with one argument of type "tuple of strings". The latter should be defined as `E of (string * string)'. There's the same issue with variant types (but not the polymorphic ones !). -- Olivier