caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Some utilities about camlp4
@ 2012-02-20 23:58 bob zhang
  2012-02-21 10:22 ` Gabriel Scherer
  0 siblings, 1 reply; 3+ messages in thread
From: bob zhang @ 2012-02-20 23:58 UTC (permalink / raw)
  To: Caml List

Hi, List
  the meta filter distributed with camlp4 is buggy and unmodular, I
put a modular one here
  http://seas.upenn.edu/~hongboz/meta_filter.zip

 building with syntax extension is really easy provided this file
  http://www.seas.upenn.edu/~hongboz/myocamlbuild.ml
It works with .inferred.mli, .pp.ml as well
-- 
Best, bob

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Some utilities about camlp4
  2012-02-20 23:58 [Caml-list] Some utilities about camlp4 bob zhang
@ 2012-02-21 10:22 ` Gabriel Scherer
  2012-02-21 13:29   ` Hongbo Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: Gabriel Scherer @ 2012-02-21 10:22 UTC (permalink / raw)
  To: bob zhang; +Cc: Caml List

I had trouble being sure what "meta filter" you were talking about.
Here's what I found out, in case other people on the list wondered the
same: the "meta" part of Camlp4 is about turning a value into a piece
of OCaml AST representing the syntax of this value. The "meta" filter
is a kind of type-conv plugin -- anterior to type-conv -- that reads
the declarations of algebraic datatypes and adds declarations for
functions doing that "meta" work on this datatype, taking values at
this type and returning pieces of Camlp4 AST.

If I understand correctly, here is the change you did -- maybe you
should put this information in a README somewhere:
instead of reading the type declarations in the whole file being
filtered, you only read those contained in a so-called "trash module",
whose name is configurable by the user (default Camlp4Trash). You then
produce declarations for metafunctions on demand, as in the old code,
but you *do not* reproduce the content of the "trash module" -- the
type declarations.

Are there other notable differences between the two implementations?
You said that the upstream one is "buggy", what kind of bugs did you
encounter? It could be interesting to fix them upstream.

It looks like you are doing this new implementation to be able to have
the meta-functions defined in a different module than the original
type declaration. What are the advantages of doing this? Could you
tell us a bit more about your initial motivations?

On Tue, Feb 21, 2012 at 12:58 AM, bob zhang <bobzhang1988@gmail.com> wrote:
> Hi, List
>  the meta filter distributed with camlp4 is buggy and unmodular, I
> put a modular one here
>  http://seas.upenn.edu/~hongboz/meta_filter.zip
>
>  building with syntax extension is really easy provided this file
>  http://www.seas.upenn.edu/~hongboz/myocamlbuild.ml
> It works with .inferred.mli, .pp.ml as well
> --
> Best, bob
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa-roc.inria.fr/wws/info/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Some utilities about camlp4
  2012-02-21 10:22 ` Gabriel Scherer
@ 2012-02-21 13:29   ` Hongbo Zhang
  0 siblings, 0 replies; 3+ messages in thread
From: Hongbo Zhang @ 2012-02-21 13:29 UTC (permalink / raw)
  To: Gabriel Scherer; +Cc: Caml List

On 2/21/12 5:22 AM, Gabriel Scherer wrote:
Hi,
> I had trouble being sure what "meta filter" you were talking about.
> Here's what I found out, in case other people on the list wondered the
> same: the "meta" part of Camlp4 is about turning a value into a piece
> of OCaml AST representing the syntax of this value. The "meta" filter
> is a kind of type-conv plugin -- anterior to type-conv -- that reads
> the declarations of algebraic datatypes and adds declarations for
> functions doing that "meta" work on this datatype, taking values at
> this type and returning pieces of Camlp4 AST.
yes.
> If I understand correctly, here is the change you did -- maybe you
> should put this information in a README somewhere:
> instead of reading the type declarations in the whole file being
> filtered, you only read those contained in a so-called "trash module",
> whose name is configurable by the user (default Camlp4Trash). You then
> produce declarations for metafunctions on demand, as in the old code,
> but you *do not* reproduce the content of the "trash module" -- the
> type declarations.
Yes, so generally you will combined it with INCLUDE like this
module Trash = struct
   INCLUDE "xx.ml"
end
This could avoid linking camlp4 (very big) when you don't need it.
It will find all type definitions in xx.ml(not the last one). It's pretty
easy to mix with other syntax extensions now.
> Are there other notable differences between the two implementations?
> You said that the upstream one is "buggy", what kind of bugs did you
> encounter? It could be interesting to fix them upstream.
the meta_float, meta_int never compiles in the original distribution
>
> It looks like you are doing this new implementation to be able to have
> the meta-functions defined in a different module than the original
> type declaration. What are the advantages of doing this? Could you
> tell us a bit more about your initial motivations?
another piece, the original file Camlp4FiltersMetaFilter was quite
unreadable, and impossible to modify according to custom needs(at least
I found it hard to read and modify...)


Thanks
> On Tue, Feb 21, 2012 at 12:58 AM, bob zhang<bobzhang1988@gmail.com>  wrote:
>> Hi, List
>>   the meta filter distributed with camlp4 is buggy and unmodular, I
>> put a modular one here
>>   http://seas.upenn.edu/~hongboz/meta_filter.zip
>>
>>   building with syntax extension is really easy provided this file
>>   http://www.seas.upenn.edu/~hongboz/myocamlbuild.ml
>> It works with .inferred.mli, .pp.ml as well
>> --
>> Best, bob
>>
>> --
>> Caml-list mailing list.  Subscription management and archives:
>> https://sympa-roc.inria.fr/wws/info/caml-list
>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>> Bug reports: http://caml.inria.fr/bin/caml-bugs
>>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-02-21 13:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-20 23:58 [Caml-list] Some utilities about camlp4 bob zhang
2012-02-21 10:22 ` Gabriel Scherer
2012-02-21 13:29   ` Hongbo Zhang

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).