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=1.2 required=5.0 tests=AWL,PORN_URL_SEX,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 discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id D5DEDBC69 for ; Tue, 1 May 2007 17:49:17 +0200 (CEST) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.228]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l41FnFio019664 for ; Tue, 1 May 2007 17:49:16 +0200 Received: by nz-out-0506.google.com with SMTP id l8so2415891nzf for ; Tue, 01 May 2007 08:49:15 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Hcup7LJSWuyk88O+cPYbvkBzWCVMBS9hYlLBJ5FWWmTdy/Q4zE9TdF4wjw3HFjrE/904dYYQAxlHB1Uyip90VjkIBxYPiQLHyUqQotjZ33l95Ch+hLS9FeOOll0aFL94xMbv8YLl+10s8ooZBnUf8fqivUDynro0RqldkKT7HUc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=R3TxRy+bR+40S+chvq2RNMYLsGg/EOwC+NRjTu78OvuhZ0xKmFbm9mhfP4UktG1RI/QqQ81nHT+U140VyRFIz3jUzQ5EHLIlIccqTrqrebqjFIi8PL3l2UsPdSzglvjB+EoYuvXMVAeHkrUt2wIDD2KKNTR00ptsnr2xVFrWTdQ= Received: by 10.115.17.1 with SMTP id u1mr2442044wai.1178034554551; Tue, 01 May 2007 08:49:14 -0700 (PDT) Received: by 10.114.183.15 with HTTP; Tue, 1 May 2007 08:49:14 -0700 (PDT) Message-ID: Date: Tue, 1 May 2007 17:49:14 +0200 From: "Nicolas Pouillard" To: "Joel Reymont" Subject: Re: Upgrading sexplib-2.7.0 to camlp4 3.10 Cc: "Caml List" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <220DCCF0-FD2D-4116-8E30-992C1AD3FE95@gmail.com> <08610813-0F6F-4BC4-BB22-42FB0CF5EC84@gmail.com> X-j-chkmail-Score: MSGID : 4637617B.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 4637617B.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 ctyp:01 ctyp:01 failwith:01 sexp:01 forall:01 syntax:01 syntax:01 hashtbl:01 hashtbl:01 camlp:01 nodes:01 failwith:01 polymorphic:01 wrote:01 On 5/1/07, Joel Reymont wrote: > Moving on! I hope this long thread will be instructive for later > Google searches. > > (* Get the path associated with a polymorphic type *) > let rec get_appl_path _loc = function > | <:ctyp< $lid:_$ >> as tp -> tp > | <:ctyp< $_$ . $_$ >> as tp -> tp > | <:ctyp< $tp$ $_$ >> -> get_appl_path _loc tp > | _ -> failwith "get_appl_path: unknown type" > > File "pa_sexp_conv.ml", line 320, characters 22-25: > While expanding quotation "ctyp" in a position of "patt": > Parse error: ident_of_ctyp: this type is not an identifier > > That would be <:ctyp< $_$ . $_$ >> as tp -> tp > > It would work (from what I understand) if it was <:ctyp< ! $_$ . $_$ > >> but what does this match and how to fix it? > > Thanks, Joel > No there is a difference between <:ctyp< ! 'a ... 'z . typ >> and <:ctyp< id1.id2 >> the first one means forall, the second one is the access of the `id2' field of the module `id1'. The goal the function get_appl_path is to get the type constructor, so go down left into all type applications. Reminder, type application depends on the syntax: original syntax: int list, (string, int list) Hashtbl.t revised syntax: list int, Hashtbl.t string (list int) If I well remember, you use camlp4of, so that's the original syntax. Then you should go right in application nodes: <:ctyp< $_$ $t$ >>. let rec get_appl_path _loc = function | <:ctyp< $id:i$ >> -> i | <:ctyp< $_$ $tp$ >> -> get_appl_path _loc tp | _ -> failwith "get_appl_path: unknown type" -- Nicolas Pouillard