Article View: fa.caml
Article #50Re: [Caml-list] automatic extaction of the .mli (and a little more) from the .ml
From: Francois Berenger
Date: Tue, 04 Jun 2013 00:30
Date: Tue, 04 Jun 2013 00:30
68 lines
5557 bytes
5557 bytes
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. -- Caml-list mailing list. Subscription management and archives: https://sympa.inria.fr/sympa/arc/caml-list Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs
Technical Details
Message-ID:
<fa.5S75rctTJoHMW7ZIVCeFhBSVlIU@ifi.uio.no>Path:
arc1-ca.pugleaf.net!bp1ni3pbd.1!nntp.google.com!npeer02.iad.highwinds-media.com!feed-me.highwinds-media.com!cyclone02.ams2.highwinds-media.com!news.highwinds-media.com!voer-me.highwinds-media.com!goblin3!goblin1!goblin.stu.neva.ru!uio.no!nntp.uio.no!.POSTED!not-for-mailReferences:
<fa.ysPYFL5+u0NnfGu8UBtNleD9SeQ@ifi.uio.no> <fa.oq1U2ELkNYjo+l/xWiLVHjNZ/Ik@ifi.uio.no>Show Full Headers
Complete Article Headers
X-Google-Thread: c0fe4b917e,bcac4a6e27ff55dd
X-Google-Attributes: gidc0fe4b917e,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ENGLISH,ASCII-7-bit
X-Received: by 10.66.27.225 with SMTP id w1mr1873021pag.22.1370305843184;
Mon, 03 Jun 2013 17:30:43 -0700 (PDT)
Path: arc1-ca.pugleaf.net!bp1ni3pbd.1!nntp.google.com!npeer02.iad.highwinds-media.com!feed-me.highwinds-media.com!cyclone02.ams2.highwinds-media.com!news.highwinds-media.com!voer-me.highwinds-media.com!goblin3!goblin1!goblin.stu.neva.ru!uio.no!nntp.uio.no!.POSTED!not-for-mail
From: Francois Berenger <berenger@riken.jp>
Newsgroups: fa.caml
Subject: Re: [Caml-list] automatic extaction of the .mli (and a little more)
from the .ml
Date: Tue, 04 Jun 2013 00:30:42 UTC
Organization: Internet mailing list
Lines: 68
Sender: caml-list-request@inria.fr
Message-ID: <fa.5S75rctTJoHMW7ZIVCeFhBSVlIU@ifi.uio.no>
References: <fa.ysPYFL5+u0NnfGu8UBtNleD9SeQ@ifi.uio.no> <fa.oq1U2ELkNYjo+l/xWiLVHjNZ/Ik@ifi.uio.no>
NNTP-Posting-Host: mail-jess.uio.no
Mime-Version: 1.0
X-Trace: readme.uio.no 1370305842 5208 129.240.7.9 (4 Jun 2013 00:30:42 GMT)
X-Complaints-To: abuse@uio.no
NNTP-Posting-Date: Tue, 4 Jun 2013 00:30:42 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6
Cc: caml-list <caml-list@inria.fr>
To: Alain Frisch <alain@frisch.fr>
X-IronPort-AV: E=Sophos;i="4.87,796,1363129200";
d="scan'208";a="20157353"
X-Original-To: caml-list@sympa.inria.fr
Delivered-To: caml-list@sympa.inria.fr
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AkIBACc0rVGGoCGwgGdsb2JhbABZgzm/CIEeDgEBCxQHPoIjAQEEAThAAQULCxgJFg8JAwIBAgFFBgoDAQcBAReHbAYMvHyPJweDWAOJHopPg1GBKYR1jHqBRg
X-IPAS-Result: AkIBACc0rVGGoCGwgGdsb2JhbABZgzm/CIEeDgEBCxQHPoIjAQEEAThAAQULCxgJFg8JAwIBAgFFBgoDAQcBAReHbAYMvHyPJweDWAOJHopPg1GBKYR1jHqBRg
X-IronPort-AV: E=Sophos;i="4.87,796,1363129200";
d="scan'208";a="20157278"
In-Reply-To: <51ACCE6A.7050704@frisch.fr>
X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2013.6.4.2139
X-Sequence: 6878
X-no-archive: yes
List-Id: <caml-list.inria.fr>
List-Archive: <http://sympa.inria.fr/sympa/arc/caml-list>
List-Help: <mailto:sympa_inria@inria.fr?subject=help>
List-Owner: <mailto:caml-list-request@inria.fr>
List-Post: <mailto:caml-list@inria.fr>
List-Subscribe: <mailto:sympa_inria@inria.fr?subject=subscribe%20caml-list>
List-Unsubscribe: <mailto:sympa_inria@inria.fr?subject=unsubscribe%20caml-list>
Original-Date: Tue, 04 Jun 2013 09:30:22 +0900
Original-Message-Id: <51AD351E.9030005@riken.jp>
Original-References: <51A81C67.50902@riken.jp> <51ACCE6A.7050704@frisch.fr>
X-Received-Bytes: 5188
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit