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 80405BC69 for ; Fri, 1 Jun 2007 18:07:55 +0200 (CEST) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.183]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l51G7rNv021957 for ; Fri, 1 Jun 2007 18:07:54 +0200 Received: by wa-out-1112.google.com with SMTP id n7so807759wag for ; Fri, 01 Jun 2007 09:07:53 -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=kkzIG33uDahU3BmaKzS5ciUOPaVci1wdQg85Zt4+1J3Fv0Ctq5aaDwsjXmLwXC27Q/r4aFAkdHkYcjYHw5bBv75S3gies0zw3KZLw40oVjTcTWxPqiUU/TBDqd+/azSeKS8VuGlZcyrSIH5PQkxBo5k7SnnwuawQpuzpJWg7+co= 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=iO96E/nOdQYqQ7qua3Av4Uu7UWSJeIBopCPS0SCfbIMiUOxgCI1nZo1fDvCGlUdmNDrD5zwVczKdSnv2hHQ/l9fEDksgxfbMar4eyTRwEZIM0ryiAPdi1Zm2zruUQ1uHWOi6ahh//2lymKxI4uFozzMUhW/kH7MKDUCU81kGK1E= Received: by 10.114.53.1 with SMTP id b1mr1886707waa.1180714072998; Fri, 01 Jun 2007 09:07:52 -0700 (PDT) Received: by 10.114.181.8 with HTTP; Fri, 1 Jun 2007 09:07:52 -0700 (PDT) Message-ID: Date: Fri, 1 Jun 2007 18:07:52 +0200 From: "Nicolas Pouillard" To: "Joel Reymont" Subject: Re: [Caml-list] Re: GenerateFold Cc: "OCaml List" In-Reply-To: <617B5749-ACF6-4992-A447-67BC699A7083@gmail.com> 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 : 46604459.001 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 46604459.001 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 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