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.1 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 discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 3972ABC0A for ; Tue, 5 Jun 2007 14:25:40 +0200 (CEST) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.182]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l55CPcId002083 for ; Tue, 5 Jun 2007 14:25:39 +0200 Received: by wa-out-1112.google.com with SMTP id m34so2255487wag for ; Tue, 05 Jun 2007 05:25:38 -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=t/nmaaj7vTT1VQQPX8Hor7Srhy6jfMOIPrDSthzPHRVoZJ+SFALVU3jbVVjVxBrySWe9UCn99Qab4HgOQnQPdnnLrOGpGGt7ya7u2QrX9om5DEdzg13HTUuQ4RrAWvG5xp+yf1TPrDtiTx1e2oIbLeut9TMjPtRUv21eAh9Io8c= 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=bz6q/jx8TzKG9JJ/Ysnb5k57+j9EcCOBFMG1xhfvvsi2JYrgobOV9KXU6eY24U3/jr79CsbOwh9X8kbVs0qzJQ3RDvDW/7ahsjTVRgkzNoJNg4bRDOvqN4a1YORugmFVsNRXUDDbRfK0BEWaKJSUnPvLhnEmjR4/P+XuJC1TpNg= Received: by 10.114.27.20 with SMTP id a20mr5877606waa.1181046338119; Tue, 05 Jun 2007 05:25:38 -0700 (PDT) Received: by 10.114.181.8 with HTTP; Tue, 5 Jun 2007 05:25:38 -0700 (PDT) Message-ID: Date: Tue, 5 Jun 2007 14:25:38 +0200 From: "Nicolas Pouillard" To: "Joel Reymont" Subject: Re: [Caml-list] Re: GenerateFold Cc: "OCaml 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: <5F8F1647-A4A8-4C71-9958-9370C44ECB84@gmail.com> <979C8DFA-180A-4AA2-8D5A-63083BDDAEE7@gmail.com> <534D9E1D-8F72-4972-8F53-DA64CA2DD20B@gmail.com> <465FB7D6.1090805@gmail.com> <617B5749-ACF6-4992-A447-67BC699A7083@gmail.com> X-j-chkmail-Score: MSGID : 46655642.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 46655642.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; bug:01 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 I've fixed the fold generation for record types in the CVS. On 6/1/07, Nicolas Pouillard wrote: > Ok there is a bug in the fold generation we using records, but the > previous example (without records) compiled fine for me. So > records+fold is buggy for now. > > On 6/1/07, Joel Reymont wrote: > > Doesn't work! > > > > On Jun 1, 2007, at 2:30 PM, Nicolas Pouillard wrote: > > > > > Got it: > > > > > > There is the solution available for meditation :) > > > > To be precise, I don't know if it works or not. I think the fold > > generator bombs out. > > > > I have no idea how to debug this but, again, it has nothing to do > > with the implementation of is_fun_arg. > > > > Simply using GenerateFold triggers the error. Notice that everything > > but class fold = ... is commented out. I'm including everything > > needed to reproduce the error, just in case. > > > > 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 "ghost-location", line 1, characters 0-0: > > This expression has type > > < array : 'b. ('a -> 'b -> 'a) -> 'b array -> 'a; bool : bool -> 'a; > > expr : A.expr -> 'a; float : float -> 'a; id : A.id -> 'a; > > input_decl : A.input_decl -> 'a; int : int -> 'a; > > list : 'c. ('a -> 'c -> 'a) -> 'c list -> 'a; > > option : 'd. ('a -> 'd -> 'a) -> 'd option -> 'a; order : > > A.order -> 'a; > > order_type : A.order_type -> 'a; program : A.program -> 'a; > > ref : 'e. ('a -> 'e -> 'a) -> 'e ref -> 'a; > > statement : A.statement -> 'a; string : string -> 'a; > > subscript : A.subscript -> 'a; ty : A.ty -> 'a; .. > > > as 'a > > but is here used with type A.order_type > > > > cat b.ml > > open A > > > > class fold = Camlp4Filters.GenerateFold.generated;; > > > > (* > > let is_fun_arg = object > > inherit fold as super > > val found = false > > method found = found > > method input_decl x = > > match x with > > | `FunArgDecl _ -> {< found = true >} > > | _ -> super#input_decl x > > end > > > > let is_fun x = (is_fun_arg#statement x)#found;; > > *) > > > > module Camlp4Trash = struct > > INCLUDE "a.ml";; > > end;; > > > > 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 > > ] > > > > and order = { > > order_type: order_type; > > } > > > > and order_type = > > [ > > | `Buy > > | `Sell > > | `Short > > | `Cover > > ] > > > > cat c.ml > > open A > > open B > > > > cat _tags > > "b.ml": use_camlp4, pp(camlp4of -I src -filter map -filter fold - > > filter trash ) > > > > > > -- > > http://topdog.cc - EasyLanguage to C# translator > > http://wagerlabs.com - Blog > > > > > > > > > > > > > > > -- > Nicolas Pouillard > -- Nicolas Pouillard