From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 21F1E7EE6A for ; Tue, 4 Jun 2013 02:30:29 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of berenger@riken.jp) identity=pra; client-ip=134.160.33.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="berenger@riken.jp"; x-sender="berenger@riken.jp"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of berenger@riken.jp designates 134.160.33.176 as permitted sender) identity=mailfrom; client-ip=134.160.33.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="berenger@riken.jp"; x-sender="berenger@riken.jp"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of postmaster@postman.riken.jp designates 134.160.33.176 as permitted sender) identity=helo; client-ip=134.160.33.176; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="berenger@riken.jp"; x-sender="postmaster@postman.riken.jp"; x-conformance=sidf_compatible; x-record-type="v=spf1" 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" Received: from postman4.riken.jp (HELO postman.riken.jp) ([134.160.33.176]) by mail2-smtp-roc.national.inria.fr with ESMTP; 04 Jun 2013 02:30:26 +0200 Received: from postman.riken.jp (postman4.riken.jp [127.0.0.1]) by postman.riken.jp (Postfix) with SMTP id 383938280F6; Tue, 4 Jun 2013 09:30:23 +0900 (JST) Received: from [172.27.98.103] (rikad98.riken.jp [134.160.214.98]) by postman.riken.jp (Postfix) with ESMTPA id 789D37F803F; Tue, 4 Jun 2013 09:30:22 +0900 (JST) Message-ID: <51AD351E.9030005@riken.jp> Date: Tue, 04 Jun 2013 09:30:22 +0900 From: Francois Berenger User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 MIME-Version: 1.0 To: Alain Frisch CC: caml-list References: <51A81C67.50902@riken.jp> <51ACCE6A.7050704@frisch.fr> In-Reply-To: <51ACCE6A.7050704@frisch.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2013.6.4.2139 Subject: Re: [Caml-list] automatic extaction of the .mli (and a little more) from the .ml 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.