Version française
Home     About     Download     Resources     Contact us    
Browse thread
Intended behavior of GenerateMap
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Nicolas Pouillard <nicolas.pouillard@g...>
Subject: Re: [Caml-list] Intended behavior of GenerateMap
I've added to  the Camlp4 wiki a documentation about
Camlp4MapGenerator and Camlp4FoldGenerator

http://brion.inria.fr/gallium/index.php/Camlp4MapGenerator
http://brion.inria.fr/gallium/index.php/Camlp4FoldGenerator

Enjoy!

On 6/13/07, Nicolas Pouillard <nicolas.pouillard@gmail.com> wrote:
> On 6/8/07, Christian Stork <caml-list@cstork.org> 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)?
>
> Your understanding is correct.
>
> > 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?
>
> Yes it will be nicer. I don't remember why I didn't do that, perhaps
> to don't have to turn the AST definition in one big mutually recursive
> type.
>
> > PS: I came to the above question after reading the source and some
> > experimentation.  Is there any place where the rationale behind
> > GenerateMap/Fold is explained?
>
> Not really the goal was just to "scrap my boiler plate" in OCaml for
> the Camlp4 AST (an economy of merely 5000 lines that are generated).
>
> --
> Nicolas Pouillard
>

-- 
Nicolas Pouillard\