caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Martin Jambon <martin.jambon@ens-lyon.org>
To: Nicolas Pouillard <nicolas.pouillard@gmail.com>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] [camlp4] str_item filters & toplevel?
Date: Thu, 17 Apr 2008 21:19:44 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0804172037270.29429@martin.ec.wink.com> (raw)
In-Reply-To: <1208457210-sup-4981@ausone.local>

On Thu, 17 Apr 2008, Nicolas Pouillard wrote:

> Excerpts from Martin Jambon's message of Thu Apr 17 17:25:20 +0200 2008:
>> On Thu, 17 Apr 2008, Nicolas Pouillard wrote:
>>
>>> Excerpts from Martin Jambon's message of Thu Apr 17 16:17:15 +0200 2008:
>>>> I started from the wiki page describing how to use AST filters:
>>>> http://brion.inria.fr/gallium/index.php/Camlp4MapGenerator
>>>>
>>>> The example doesn't work in the toplevel (3.10.1), although it works
>>>> otherwise. How to make it work?
>>>
>>> By patching the camlp4 sources :)
>>
>> Is it a bug that has to be fixed?
>
> It  could  be  seen  as a bug, but the behavior is not completely clear, since
> applying  the  filters  to each toplevel phrase is different from calling them
> only once on the whole module implem.

Thanks.
I'll look at the code for a better understanding.

I think that the 2 following cases are pretty common:

a. inserting some constant code once at the beginning of the file (or
    module), such as "open Foo"
b. replacing a str_item by other str_items

Both were problematic in camlp4 3.09, requiring some fragile or 
undocumented hacks. It would be extremely useful to have a clean solution 
to these problems.

It seems to me that both (a) and (b) could be implemented and 
made available in the toplevel without theoretical difficulties.

I can imagine a third situation consisting in performing a full 
file/module analysis and inserting something at the beginning or at the 
end. That also could be implemented, although it would clearly not be 
available in the toplevel.


Martin


>> If it's already fixed, which version?
>
> Not already fixed.
>
> -- 
> Nicolas Pouillard aka Ertai

--
http://wink.com/profile/mjambon
http://mjambon.com


  reply	other threads:[~2008-04-17 19:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-17 14:17 Martin Jambon
2008-04-17 14:42 ` [Caml-list] " Nicolas Pouillard
2008-04-17 15:25   ` Martin Jambon
2008-04-17 18:35     ` Nicolas Pouillard
2008-04-17 19:19       ` Martin Jambon [this message]
2008-04-18  7:19         ` Nicolas Pouillard

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=Pine.LNX.4.64.0804172037270.29429@martin.ec.wink.com \
    --to=martin.jambon@ens-lyon.org \
    --cc=caml-list@inria.fr \
    --cc=nicolas.pouillard@gmail.com \
    /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).