caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christian Stork <caml-list@cstork.org>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Intended behavior of GenerateMap
Date: Sat, 23 Jun 2007 14:04:55 -0700	[thread overview]
Message-ID: <20070623210455.GA5526@stirner.roentgeninstitut.de> (raw)
In-Reply-To: <cd67f63a0706231159sdd3a6a0y7cb37e953b224b37@mail.gmail.com>

On Sat, Jun 23, 2007 at 08:59:24PM +0200, Nicolas Pouillard 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)?
> >
> >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?

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.)
 
Then you don't even need to change your current usages of GenerateMap.

> Note that the Camlp4Trash trick is still needed by those that wants
> have the type declaration separated from these classes.

Sure.

-- 
Chris Stork   <>  Support eff.org!  <>   http://www.ics.uci.edu/~cstork/
OpenPGP fingerprint:  B08B 602C C806 C492 D069  021E 41F3 8C8D 50F9 CA2F


  reply	other threads:[~2007-06-23 21:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-08  8:36 Christian Stork
2007-06-13 11:36 ` [Caml-list] " Nicolas Pouillard
2007-06-14 12:35   ` Nicolas Pouillard
2007-06-23 18:59 ` Nicolas Pouillard
2007-06-23 21:04   ` Christian Stork [this message]
2007-06-24  8:13     ` Nicolas Pouillard
2007-06-24 10:21       ` Anti-matching Frédéric Gava
2007-06-24 10:52         ` [Caml-list] Anti-matching David Thomas
2007-06-24 12:32           ` Frédéric Gava

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070623210455.GA5526@stirner.roentgeninstitut.de \
    --to=caml-list@cstork.org \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).