🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fa.caml
Article #55

Re: [Caml-list] automatic extaction of the .mli (and a little more) from the .ml

#55
From: Alain Frisch
Date: Tue, 04 Jun 2013 08:36
50 lines
5098 bytes
On 06/04/2013 02:30 AM, Francois Berenger wrote:
> - 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

Yes, it's quite easy to add some priority information as an extra 
argument to the [@mli] attribute.  (That said, since extension_points is 
not yet merged in the official version, I don't think it's worth 
spending time on the prototype right now.)

Showing the priority in the .mli (in the form of attributes) is 
straightforward (currently, the source syntax pretty-printer 
pprintast.ml does not support printing attributes, but this will be fixed).

> - can you also handle the transfer of ocamldoc comments in the .ml
>    to the .mli

In this form, this is very tricky, because the tool is based on the 
result of the OCaml parser which does not store the ocamldoc comments. 
The tool would need to steal from ocamldoc the (complex) logic required 
to re-parse the source code, extract the attributes, attach them to 
components of the parsetree/typedtree.

What is doable is to have the tool accept more attributes (or more 
arguments to the [@mli] attribute) representing text to be used as 
ocamldoc comments in the generated .mli.  Instead of producing an AST 
for the generated signatures (which is then pretty-printed), the tool 
would directly emit the content of the .mli (with ocamldoc attributes).


> (I read later that you also have a final solution
>    for ocamldoc too)?

Certainly not!  I'm only suggesting that a tool similar to ocamldoc 
could be based on attributes, and that it would be more robust and much 
easier to implement.  But designing and implementing this tool is still 
a serious engineering task, and unless someone puts the required 
manpower in this project, this is not going to happen.


Alain

-- 
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.lCbTQoTP+VjkJXGZg1GRw2BcnjU@ifi.uio.no>
Path: arc1-ca.pugleaf.net!bp1ni86pbd.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
References: <fa.ysPYFL5+u0NnfGu8UBtNleD9SeQ@ifi.uio.no> <fa.oq1U2ELkNYjo+l/xWiLVHjNZ/Ik@ifi.uio.no> <fa.5S75rctTJoHMW7ZIVCeFhBSVlIU@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 w1mr2004102pag.22.1370335018361;
        Tue, 04 Jun 2013 01:36:58 -0700 (PDT)
Path: arc1-ca.pugleaf.net!bp1ni86pbd.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: Alain Frisch <alain@frisch.fr>
Newsgroups: fa.caml
Subject: Re: [Caml-list] automatic extaction of the .mli (and a little more)
 from the .ml
Date: Tue, 04 Jun 2013 08:36:57 UTC
Organization: Internet mailing list
Lines: 50
Sender: caml-list-request@inria.fr
Message-ID: <fa.lCbTQoTP+VjkJXGZg1GRw2BcnjU@ifi.uio.no>
References: <fa.ysPYFL5+u0NnfGu8UBtNleD9SeQ@ifi.uio.no> <fa.oq1U2ELkNYjo+l/xWiLVHjNZ/Ik@ifi.uio.no> <fa.5S75rctTJoHMW7ZIVCeFhBSVlIU@ifi.uio.no>
NNTP-Posting-Host: mail-jess.uio.no
Mime-Version: 1.0
X-Trace: readme.uio.no 1370335017 4046 129.240.7.9 (4 Jun 2013 08:36:57 GMT)
X-Complaints-To: abuse@uio.no
NNTP-Posting-Date: Tue, 4 Jun 2013 08:36:57 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:22.0) Gecko/20100101 Thunderbird/22.0
Cc: caml-list <caml-list@inria.fr>
To: Francois Berenger <berenger@riken.jp>
X-IronPort-AV: E=Sophos;i="4.87,798,1363129200"; 
   d="scan'208";a="20204872"
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: AioBAEmmrVHB/BfUcmdsb2JhbABZgzkBvweBGA4BDAgMCRQDJYIjAQEFOEABEAsYCRYPCQMCAQIBRQYKAwEHAQEXh3a9KI8hBQeDWAOTbYNRgSmEdYx6gTk
X-IPAS-Result: AioBAEmmrVHB/BfUcmdsb2JhbABZgzkBvweBGA4BDAgMCRQDJYIjAQEFOEABEAsYCRYPCQMCAQIBRQYKAwEHAQEXh3a9KI8hBQeDWAOTbYNRgSmEdYx6gTk
X-IronPort-AV: E=Sophos;i="4.87,798,1363129200"; 
   d="scan'208";a="16675996"
In-Reply-To: <51AD351E.9030005@riken.jp>
X-Sequence: 6885
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 10:36:48 +0200
Original-Message-Id: <51ADA720.7070409@frisch.fr>
Original-References: <51A81C67.50902@riken.jp> <51ACCE6A.7050704@frisch.fr> <51AD351E.9030005@riken.jp>
X-Received-Bytes: 4728
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit