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 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id EFA0EBC69 for ; Fri, 1 Jun 2007 00:34:55 +0200 (CEST) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.248]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l4VMYs2s002375 for ; Fri, 1 Jun 2007 00:34:55 +0200 Received: by an-out-0708.google.com with SMTP id c24so131142ana for ; Thu, 31 May 2007 15:34:54 -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=nYcP48CHpyz0TrEFiqJ50TNnLJXPFqFc6Bh72zrCs5NGY6DDS2aY/8xIQNz0AEA4kUeeylQtd3NAUAglFghdqQsZpQBbeSJQ0O6Pc9c0xIPQjElADRRNX9OOPX0/O/DLpVBCKMX+01OdM6BlthhaaSA0YN9Yd38xfN6Iahz2ncI= 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=bo+42W5PHwtBL/POnDJl0nI6/QY69ljFx8PukAbCAU18SbjURpcdJ+KHcgVHY4fAfi2HPybmpwIC9vBc4w/HGWEr3Y0fcJ6Z1pTpltIvVWznfju+Aho/aQVc85bjiZ2aluGAIvDilaOyefUcgLi6HOGy7nUgMXATK0PjOfwOUoU= Received: by 10.78.56.19 with SMTP id e19mr718701hua.1180650893326; Thu, 31 May 2007 15:34:53 -0700 (PDT) Received: from ?192.168.1.33? ( [81.32.170.248]) by mx.google.com with ESMTP id d23sm265935nfh.2007.05.31.15.34.52; Thu, 31 May 2007 15:34:52 -0700 (PDT) In-Reply-To: References: <5F8F1647-A4A8-4C71-9958-9370C44ECB84@gmail.com> <979C8DFA-180A-4AA2-8D5A-63083BDDAEE7@gmail.com> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <534D9E1D-8F72-4972-8F53-DA64CA2DD20B@gmail.com> Cc: "OCaml List" Content-Transfer-Encoding: 7bit From: Joel Reymont Subject: Re: GenerateFold Date: Thu, 31 May 2007 23:34:57 +0100 To: "Nicolas Pouillard" X-Mailer: Apple Mail (2.752.3) X-j-chkmail-Score: MSGID : 465F4D8E.001 on concorde : j-chkmail score : XXX : 5/20 1 0.000 -> 3 X-Miltered: at concorde with ID 465F4D8E.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; byte:01 usr:01 ocamlc:01 camlp:01 -pp:01 cmo:01 bool:01 bool:01 expr:01 expr:01 decl:01 decl:01 camlp:01 val:01 struct:01 I thought I would try to reproduce the issue but I can't. I get a different issue instead. It doesn't like the following line | `FunArgDecl _ -> {< found = true >} or `FunargDecl to be precise. Also, what does {< found = true >} mean? Thanks, Joel --- ocamlbuild c.byte + /usr/local/bin/ocamlc.opt -c -I +camlp4 -pp 'camlp4of -I src - filter map -filter fold -filter trash ' -o b.cmo b.ml File "b.ml", line 11, characters 8-21: This pattern matches values of type [> `FunArgDecl of 'a ] but is here used to match values of type < array : 'c. ('b -> 'c -> 'b) -> 'c array -> 'b; bool : bool -> 'b; expr : A.expr -> 'b; float : float -> 'b; found : bool; id : A.id -> 'b; input_decl : A.input_decl -> 'b; int : int -> 'b; list : 'd. ('b -> 'd -> 'b) -> 'd list -> 'b; option : 'e. ('b -> 'e -> 'b) -> 'e option -> 'b; program : A.program -> 'b; ref : 'f. ('b -> 'f -> 'b) -> 'f ref - > 'b; statement : A.statement -> 'b; string : A.id -> 'b; subscript : A.subscript -> 'b; ty : A.ty -> 'b > as 'b cat _tags "b.ml": use_camlp4, pp(camlp4of -I src -filter map -filter fold - filter trash ) cat a.ml type id = string and program = statement list and ty = [ | `TyAny ] and statement = [ | `Skip | `InputDecls of input_decl list ] and subscript = expr list and input_decl = [ | `InputDecl of id * ty * expr | `FunArgDecl of id * ty * subscript ] and expr = [ | `Int of int | `Float of float | `Str of string ] cat b.ml open A class fold = Camlp4Filters.GenerateFold.generated;; let is_fun_arg = object (self) inherit fold as super val found = false method found = found method input_decl x = match super#input_decl x with | `FunArgDecl _ -> {< found = true >} | _ -> self end let is_fun x = (is_fun_arg#statement x)#found;; module Camlp4Trash = struct INCLUDE "a.ml";; end;; cat c.ml open A open B -- http://topdog.cc - EasyLanguage to C# translator http://wagerlabs.com - Blog