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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 7EDEF7EE6A for ; Mon, 3 Jun 2013 19:12:14 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of alain@frisch.fr) identity=pra; client-ip=193.252.23.210; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="alain@frisch.fr"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of alain@frisch.fr) identity=mailfrom; client-ip=193.252.23.210; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="alain@frisch.fr"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@msa.smtpout.orange.fr) identity=helo; client-ip=193.252.23.210; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="alain@frisch.fr"; x-sender="postmaster@msa.smtpout.orange.fr"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoIAAF/NrFHB/BfSlGdsb2JhbABZgzm/BYEZDgEBAQEJCwkJFAMlgiMBAQU4QBELGAkWDwkDAgECAUUGAQwIAQGIDQi8BI8ug1gDlz6BKYR1jHqBOQ X-IPAS-Result: AoIAAF/NrFHB/BfSlGdsb2JhbABZgzm/BYEZDgEBAQEJCwkJFAMlgiMBAQU4QBELGAkWDwkDAgECAUUGAQwIAQGIDQi8BI8ug1gDlz6BKYR1jHqBOQ X-IronPort-AV: E=Sophos;i="4.87,794,1363129200"; d="scan'208";a="16614838" Received: from msa01.smtpout.orange.fr (HELO msa.smtpout.orange.fr) ([193.252.23.210]) by mail3-smtp-sop.national.inria.fr with ESMTP; 03 Jun 2013 19:12:13 +0200 Received: from [192.168.1.116] ([92.151.120.247]) by mwinf5d48 with ME id jtCB1l00h5LMejg03tCCFk; Mon, 03 Jun 2013 19:12:13 +0200 Message-ID: <51ACCE6A.7050704@frisch.fr> Date: Mon, 03 Jun 2013 19:12:10 +0200 From: Alain Frisch User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:22.0) Gecko/20100101 Thunderbird/22.0 MIME-Version: 1.0 To: Francois Berenger , caml-list References: <51A81C67.50902@riken.jp> In-Reply-To: <51A81C67.50902@riken.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] automatic extaction of the .mli (and a little more) from the .ml 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 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). 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 (experimental/frisch/Makefile in the extenstion_point branch contains everything to compile and run these little demos.) -- Alain