🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fa.caml
Article #29

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

#29
From: Malcolm Matalka
Date: Fri, 31 May 2013 05:31
48 lines
5178 bytes
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.  .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.  On
top of that, ocamlc will fail to compile if your .ml and .mli don't
match, 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.

In short, I think it's a good thing to maintain these things by hand.
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.OQroQDVDk9br1ZhQEIL1NaakR5I@ifi.uio.no>
Path: arc1-ca.pugleaf.net!fw11ni17059wic.0!nntp.google.com!goblin2!goblin1!goblin.stu.neva.ru!uio.no!nntp.uio.no!.POSTED!not-for-mail
References: <fa.ysPYFL5+u0NnfGu8UBtNleD9SeQ@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.180.14.40 with SMTP id m8mr798848wic.7.1369978309968;
        Thu, 30 May 2013 22:31:49 -0700 (PDT)
Path: arc1-ca.pugleaf.net!fw11ni17059wic.0!nntp.google.com!goblin2!goblin1!goblin.stu.neva.ru!uio.no!nntp.uio.no!.POSTED!not-for-mail
From: Malcolm Matalka <mmatalka@gmail.com>
Newsgroups: fa.caml
Subject: Re: [Caml-list] automatic extaction of the .mli (and a little more)
 from the .ml
Date: Fri, 31 May 2013 05:31:49 UTC
Organization: Internet mailing list
Lines: 48
Sender: caml-list-request@inria.fr
Message-ID: <fa.OQroQDVDk9br1ZhQEIL1NaakR5I@ifi.uio.no>
References: <fa.ysPYFL5+u0NnfGu8UBtNleD9SeQ@ifi.uio.no>
NNTP-Posting-Host: mail-jess.uio.no
Mime-Version: 1.0
X-Trace: readme.uio.no 1369978309 9931 129.240.7.9 (31 May 2013 05:31:49 GMT)
X-Complaints-To: abuse@uio.no
NNTP-Posting-Date: Fri, 31 May 2013 05:31:49 +0000 (UTC)
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Cc: caml-list <caml-list@inria.fr>
To: Francois Berenger <berenger@riken.jp>
X-IronPort-AV: E=Sophos;i="4.87,776,1363129200"; 
   d="scan'208";a="19718533"
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: ArQAAD41qFFKfVMyjmdsb2JhbABZgmi/OoECFg4BAQEBBw0JCRIGJIIjAQEEAUABGx0BAwELBgULFiUPAQQPEQEFASITh3oBAwkGAZ1DjEiCfYRxChknDViIBAEFDI8QB4NXA5Ntg1GPWz+ENQ
X-IPAS-Result: ArQAAD41qFFKfVMyjmdsb2JhbABZgmi/OoECFg4BAQEBBw0JCRIGJIIjAQEEAUABGx0BAwELBgULFiUPAQQPEQEFASITh3oBAwkGAZ1DjEiCfYRxChknDViIBAEFDI8QB4NXA5Ntg1GPWz+ENQ
X-IronPort-AV: E=Sophos;i="4.87,776,1363129200"; 
   d="scan'208";a="16277636"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=from:to:cc:subject:references:date:in-reply-to:message-id
         :user-agent:mime-version:content-type;
        bh=w6QaPs+vCL5krYOJVh26tMR/sR2hclCx0fY8kJVm3ck=;
        b=PSd1RLQMJtw7HWP4M0+nQ3tuarSYApw2G5k7pn54N/u90zU861LMdS7+1QqjS1etRD
         CNbcrk/YUK1qmKe3/TFbxUunbjy57t5T3zo/pDzoYkUQkylWX119jl3COfTljZwHYGmp
         Fc3BS7dHycyQfcv8dAmkW4IQxjUyH5PBVRfVg+0tnOCf7NXStoyFfT/BRRgY93bgZfel
         jkMxxkW6tGGE1fPrwS16+Hdr2aH8S2Bpy0UXR8GcO4/Aj2Ju3Mhkk2zBHwkvabmlVgOM
         URbrBg03zXa2mWmf2NG4Jhyfb7FZvXdgsP+UJUsAYVqWcsfc6DiHi7ZGtKLi6z16UzRR
         Sl6g==
X-Received: by 10.14.107.69 with SMTP id n45mr12109110eeg.67.1369978301462;
        Thu, 30 May 2013 22:31:41 -0700 (PDT)
In-Reply-To: <51A81C67.50902@riken.jp> (Francois Berenger's message of "Fri,
 31 May 2013 12:43:35 +0900")
X-Sequence: 6854
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 05:31:40 +0000
Original-Message-Id: <87bo7rogub.fsf@gmail.com>
Original-References: <51A81C67.50902@riken.jp>
Content-Type: text/plain