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.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 257D4BC69 for ; Tue, 1 May 2007 19:04:33 +0200 (CEST) Received: from ik-out-1112.google.com (ik-out-1112.google.com [66.249.90.178]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l41H4WCU011094 for ; Tue, 1 May 2007 19:04:32 +0200 Received: by ik-out-1112.google.com with SMTP id c29so1978222ika for ; Tue, 01 May 2007 10:04:32 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=TILa/Ct9idbpTEwiUVEWFoMZsRA7lXD0B7C4N1U3je5ShBJzH+2u5GQRg6njrc9py3RzPU0onLmE6EZsmtCF9iNkM2TFzPDf4xcU4DqH5IsmN1EkNbTl9SfLkC8G057clm7gvl1q/YJd4pz3xDVB3ou9kC6BPRbdc9H8JNaVlm4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer; b=gL8QmjQOiWOWnJ5zKFNFwVZXjIvSYxKtcIuoYrWV/W27kDhvcbenSc/pA+X4ZrBKvTE2CcmpDpivRp+ZlzXeU+8zDdIC3onSVLHK2wWra9FkjPGn4KcV1KzFR2QoaNSfods7A1AQOCpTgbIgE/lh23aYpa4p3s2KfOzCZCNMvUM= Received: by 10.82.120.14 with SMTP id s14mr14354858buc.1178039072184; Tue, 01 May 2007 10:04:32 -0700 (PDT) Received: from ?192.168.1.34? ( [83.52.237.136]) by mx.google.com with ESMTP id b30sm17822ika.2007.05.01.10.04.28; Tue, 01 May 2007 10:04:29 -0700 (PDT) In-Reply-To: References: <220DCCF0-FD2D-4116-8E30-992C1AD3FE95@gmail.com> <08610813-0F6F-4BC4-BB22-42FB0CF5EC84@gmail.com> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: "Caml List" Content-Transfer-Encoding: 7bit From: Joel Reymont Subject: camlp4 3.10: Matching variant types Date: Tue, 1 May 2007 18:04:25 +0100 To: "Nicolas Pouillard" X-Mailer: Apple Mail (2.752.3) X-j-chkmail-Score: MSGID : 46377320.004 on concorde : j-chkmail score : XXX : 5/20 1 0.000 -> 3 X-Miltered: at concorde with ID 46377320.004 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 ctyp:01 ctyp:01 camlp:01 defs:01 foo:01 foo:01 2007,:98 wrote:01 constructor:01 matched:01 int:01 int:01 variant:02 variant:02 On May 1, 2007, at 5:27 PM, Nicolas Pouillard wrote: > << `id >> was encoded as RfTag(_loc, true, []) So then "RfTag (cnstr, _, [])", a constructor without arguments, would become <:ctyp< $`id$ >> whereas "RfTag (cnstr, _, tps)" <:ctyp< $id:tys$ >>? Wasn't <:ctyp< $id$ >> used for something else already? camlp4of -str '<:ctyp< int >>' Ast.TyId (_loc, Ast.IdLid (_loc, "int")) I thought that id is used for regular types, according to the above. I tried to see what variant type defs expand to (below). camlp4of -str '<:ctyp< [`Foo] >>' Ast.TyVrnEq (_loc, Ast.TyVrn (_loc, "Foo")) camlp4of -str '<:ctyp< [Foo] >>' Ast.TyVrnEq (_loc, Ast.TyId (_loc, Ast.IdUid (_loc, "Foo"))) camlp4of -str '<:ctyp< [`Foo|`Bar] >>' Ast.TyVrnEq (_loc, Ast.TyOr (_loc, Ast.TyVrn (_loc, "Foo"), Ast.TyVrn (_loc, "Bar"))) camlp4of -str '<:ctyp< [Foo|Bar] >>' Ast.TyVrnEq (_loc, Ast.TyOr (_loc, Ast.TyId (_loc, Ast.IdUid (_loc, "Foo")), Ast.TyId (_loc, Ast.IdUid (_loc, "Bar")))) Is there a "ctyp", "id", "lid", etc. shortcut that should be used for TyVrnEq? Is there a path through the camlp4 sources that would enable me to figure this out? Ast.TyId (_loc, Ast.IdUid (_loc, "Foo") This is matched by $id:uid", correct? Is there a "shortcut" for TyOr and TyVrn? I'm afraid I'm still lost here, thus my asking for more information. Thanks, Joel -- http://wagerlabs.com/