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 0E8BBBC69 for ; Sun, 24 Jun 2007 10:13:31 +0200 (CEST) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.178]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l5O8DTLV007875 for ; Sun, 24 Jun 2007 10:13:30 +0200 Received: by wa-out-1112.google.com with SMTP id j37so1410088waf for ; Sun, 24 Jun 2007 01:13:28 -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=mqtjxKlk7lPWxtodVDQjJNUVBH+8IVdDPbSv5yTXi7A/O0MO5Vc4suZ9ug+G7bmvH1VJRs/I2zIMr8QYAEYGDXezwiQrQC3fsQAsfAdMK6b3Yu8AaWeCWGs1PJcfyQjcc9jqV36cEfz6RZE8D089m2JI1NXchngOmVeOo+pF8TM= 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=ZypFAZ55j1ZyV4NsAoZxvNbQfJD5pp+KwoAmD/69S8Z6agSsXWGy37S5lFvSyS/mR8xRfM9O9sYLYu9s8dkZnbyVJGAWf884BJvZkeGYu0qLxaIeramybza42YLdxxX+VizW49nABvQr2T7PQA7rd7lKj7bajGtSCKhas8PsPI8= Received: by 10.115.16.1 with SMTP id t1mr4424113wai.1182672808826; Sun, 24 Jun 2007 01:13:28 -0700 (PDT) Received: by 10.114.181.8 with HTTP; Sun, 24 Jun 2007 01:13:28 -0700 (PDT) Message-ID: Date: Sun, 24 Jun 2007 10:13:28 +0200 From: "Nicolas Pouillard" To: "Christian Stork" Subject: Re: [Caml-list] Intended behavior of GenerateMap Cc: caml-list@yquem.inria.fr In-Reply-To: <20070623210455.GA5526@stirner.roentgeninstitut.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070608083625.GA17210@stirner.roentgeninstitut.de> <20070623210455.GA5526@stirner.roentgeninstitut.de> X-j-chkmail-Score: MSGID : 467E27A9.002 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 467E27A9.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; 0200,:01 camlp:01 camlp:01 recursive:01 constructors:01 recursive:01 23,:98 suck:98 wrote:01 wrote:01 syntactic:01 caml-list:01 caml-list:01 modules:02 tuple:02 On 6/23/07, Christian Stork wrote: > On Sat, Jun 23, 2007 at 08:59:24PM +0200, Nicolas Pouillard wrote: > > On 6/8/07, Christian Stork wrote: > > >Hi, > > > > > >Is my understanding correct that running "camlp4of -filter map ..." over > > > > > > class map = Camlp4Filters.GenerateMap.generated > > > > > >will produce a map class for *all* types defined in the current file -- > > >irrespective if the types are incapsulated in a module (which is then > > >used for the Camlp4Trash trick)? > > > > > >Wouldn't it be much nicer, i.e., more economical and more precise, if > > >the above only produces a map class for the most recently defined type > > >/ mutually recursive types? > > > > > > > Indeed it's nicer... > > > > These days I've improved this generator to be able to generate, > > multiple maps and folds (Map{2,3,4...}, Fold{2,3,4...}). And also the > > combination of both: MapFold{,2,3,4...}. > > Map2 as in List.map2? So what happens if several ASTs have different > shapes? Almost like List.map2... But it takes a tuple instead of sevral arguments, and call #map2_failure when head constructors are different. > > BTW, where it that code? Oh, just found it on the release310 branch. > Great, that means we'll get to use it in 3.10.1 already. :-) > > > I've also followed your advise by taking in account only the last > > defined set of mutually recursive types. > > Actually, I think the ideal solution is to generate a Map for > the last type and to "suck in" all the other types that are > (transitively) used by that definition. (Maybe that's what your're > doing already anyway.) > No I keep just the last syntactic definition. It's not that simple to gather the others, since features like modules, open, include, require a complete analysis. -- Nicolas Pouillard