caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Francois Berenger <berenger@riken.jp>
To: Alain Frisch <alain@frisch.fr>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] automatic extaction of the .mli (and a little more) from the .ml
Date: Tue, 04 Jun 2013 09:30:22 +0900	[thread overview]
Message-ID: <51AD351E.9030005@riken.jp> (raw)
In-Reply-To: <51ACCE6A.7050704@frisch.fr>

On 06/04/2013 02:12 AM, Alain Frisch wrote:
> I've created a proof-of-concept implementation of such a tool as part of
> the "extension_points" branch, which introduces a syntax for attributes
> on various syntactic items (including type declarations and value
> bindings).
>
> Note that I *don't* endorse the idea of generating .mli files
> automatically :-)
>
> Here is the code:
>
> http://caml.inria.fr/cgi-bin/viewvc.cgi/ocaml/branches/extension_points/experimental/frisch/nomli.ml?revision=HEAD&view=markup
>
> and an example:
>
> http://caml.inria.fr/cgi-bin/viewvc.cgi/ocaml/branches/extension_points/experimental/frisch/test_nomli.ml?revision=HEAD&view=markup

Alain, I am amazed!

Would it be possible to handle the two following things?

- being able to assign priorities to things exported in the
   .mli file (to re-order the .mli in some way that makes it easier to
   grasp). I think floats should be used and the priority assigned
   should be shown in the .mli so that users can quickly see what
   priority they need to change in the .ml to obtain the order
   they want in the .mli

- can you also handle the transfer of ocamldoc comments in the .ml
   to the .mli (I read later that you also have a final solution
   for ocamldoc too)?

The tool I was thinking of would not do anything more...

> On 05/31/2013 05:43 AM, Francois Berenger wrote:
>> - I think there should be tags in the .ml file as comments
>>    that say "export this" to the .mli.
>
> Encoding annotations in comments is very fragile, because they are not
> kept by the parser in the generated Parsetree, and it is not
> well-defined to which component each component refers to.  ocamldoc uses
> comments, and as a consequence, it does not combine well with
> preprocessors (Camlp4/Camlp5/Fan/ppx extensions cannot generate
> documentation fragments, and it is likely that they break existing
> ones).  A version of ocamldoc based on attributes of the
> extension_points branch would be much more robust (and simple).

The same is true for qtest I guess.

>  I've
> written another toy POC implementation of a mini-ocamldoc based on
> attributes:
>
> http://caml.inria.fr/cgi-bin/viewvc.cgi/ocaml/branches/extension_points/experimental/frisch/minidoc.ml?revision=HEAD&view=markup
>
> http://caml.inria.fr/cgi-bin/viewvc.cgi/ocaml/branches/extension_points/experimental/frisch/testdoc.mli?revision=HEAD&view=markup

Thanks a lot for the code and explanations.

Best regards,
Francois.


  reply	other threads:[~2013-06-04  0:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-31  3:43 Francois Berenger
2013-05-31  5:31 ` Malcolm Matalka
2013-05-31  6:26   ` Francois Berenger
2013-05-31  9:10     ` Romain Bardou
2013-06-03  1:33       ` Francois Berenger
2013-06-04  7:53       ` David Allsopp
2013-06-04  8:22         ` Alain Frisch
2013-06-04  8:54           ` David Allsopp
2013-06-04  8:22         ` Romain Bardou
2013-06-04  9:05           ` David Allsopp
2013-05-31 23:13     ` oliver
2013-06-03  1:28       ` Francois Berenger
2013-06-03 12:01         ` Malcolm Matalka
2013-05-31 15:21   ` [Caml-list] " Hongbo Zhang
2013-05-31 15:42     ` Yaron Minsky
2013-05-31 23:20       ` Jacques Le Normand
2013-06-01  9:12     ` Florent Monnier
2013-06-03 17:12 ` [Caml-list] " Alain Frisch
2013-06-04  0:30   ` Francois Berenger [this message]
2013-06-04  8:36     ` Alain Frisch

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=51AD351E.9030005@riken.jp \
    --to=berenger@riken.jp \
    --cc=alain@frisch.fr \
    --cc=caml-list@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).