🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fa.caml
Article #30

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

#30
From: Francois Berenger
Date: Fri, 31 May 2013 06:26
78 lines
5287 bytes
On 05/31/2013 02:31 PM, Malcolm Matalka wrote:
> I know of no such tool, but in counter to your premise: I used to think
> maintaining a .ml and .mli was foolish, however I no longer do.

It itches me and it won't stop.

>  .mli is
> effectively documentation for me.  It contains a lot of comments and is
> generally written to reflect how the API should be used rather than the
> order in which I must express functions to get ta .ml to compile.

I'm proposing to add some number to tags so that things can
be reordered when dumped to the .mli.

>  On
> top of that, ocamlc will fail to compile if your .ml and .mli don't
> match,

The tool I am thinking about is a preprocessor.
It would be used to generate all .mli files before the compilation
of the .ml ones (at least in _MY_ OCaml projects).

 > so it's a valuable check that what I think my module does is also
> what the compiler does.  I also tend to write the .mli first, then write
> the .ml.  I find it to be a great way to develop.

I don't.

> In short, I think it's a good thing to maintain these things by hand.

I don't:
dumb_job + error_prone + can_be_automated + duplication_of_information 
--> the computer will do it for me.

I'm thinking about something small.
It may not work on all cases people can come up with.
I don't do very elaborated things usually so it will work for me,
at least.

> But as for your original question I'm completely useless, sorry.
>
> /M
>
> Francois Berenger <berenger@riken.jp> writes:
>
>> Hello,
>>
>> Is there some recommended tool/script to generate a .mli
>> from the corresponding .ml?
>>
>> I want a little more than ocamlc -i:
>>
>> - I think there should be tags in the .ml file as comments
>>    that say "export this" to the .mli.
>>    By default, things are not exported.
>> - maybe it should have an option to say to replicate
>>    the ocamldoc comments in the .mli.
>> - it could be nice if the order in which things are exported
>>    to the .mli can be specified, maybe as an argument of the tag.
>>    So that the .mli can be more readable (only backward references
>>    to concepts, etc.)
>>
>> If there is a need to create a tool, let's call it "nomli". :)
>>
>> Regards,
>> F.
>>
>> PS: I'm not going to maintain both a .mli and a .ml.
>>      I feel it is a dumb and error-prone job and that
>>      itches me.
>


-- 
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.bD6TGMY7hcijji7TE20fgVNMYJ0@ifi.uio.no>
Path: arc1-ca.pugleaf.net!bp1ni28287pbd.1!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin3!goblin.stu.neva.ru!newsfeed3.funet.fi!newsfeeds.funet.fi!uio.no!nntp.uio.no!.POSTED!not-for-mail
References: <fa.ysPYFL5+u0NnfGu8UBtNleD9SeQ@ifi.uio.no> <fa.OQroQDVDk9br1ZhQEIL1NaakR5I@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.189.195 with SMTP id gk3mr2083050pac.16.1369981584250;
        Thu, 30 May 2013 23:26:24 -0700 (PDT)
Path: arc1-ca.pugleaf.net!bp1ni28287pbd.1!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!goblin3!goblin.stu.neva.ru!newsfeed3.funet.fi!newsfeeds.funet.fi!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: Fri, 31 May 2013 06:26:23 UTC
Organization: Internet mailing list
Lines: 78
Sender: caml-list-request@inria.fr
Message-ID: <fa.bD6TGMY7hcijji7TE20fgVNMYJ0@ifi.uio.no>
References: <fa.ysPYFL5+u0NnfGu8UBtNleD9SeQ@ifi.uio.no> <fa.OQroQDVDk9br1ZhQEIL1NaakR5I@ifi.uio.no>
NNTP-Posting-Host: mail-jess.uio.no
Mime-Version: 1.0
X-Trace: readme.uio.no 1369981583 13452 129.240.7.9 (31 May 2013 06:26:23 GMT)
X-Complaints-To: abuse@uio.no
NNTP-Posting-Date: Fri, 31 May 2013 06:26:23 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6
To: caml-list@inria.fr
X-IronPort-AV: E=Sophos;i="4.87,777,1363129200"; 
   d="scan'208";a="19723931"
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: AgQBAONBqFGGoCGhh2dsb2JhbABZgzq+aIEZDgEBAQgNCQcWKIIjAQEEAScRRgsLGAklDwJGEwYCAQGIAwa7PI8jFoNBA4keik+DUYYejHqBRg
X-IPAS-Result: AgQBAONBqFGGoCGhh2dsb2JhbABZgzq+aIEZDgEBAQgNCQcWKIIjAQEEAScRRgsLGAklDwJGEwYCAQGIAwa7PI8jFoNBA4keik+DUYYejHqBRg
X-IronPort-AV: E=Sophos;i="4.87,777,1363129200"; 
   d="scan'208";a="19723860"
In-Reply-To: <87bo7rogub.fsf@gmail.com>
X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2013.5.31.61516
X-Sequence: 6855
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: Fri, 31 May 2013 15:26:11 +0900
Original-Message-Id: <51A84283.80309@riken.jp>
Original-References: <51A81C67.50902@riken.jp> <87bo7rogub.fsf@gmail.com>
Bytes: 4983
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit