Article View: fa.caml
Article #39Re: [Caml-list] automatic extaction of the .mli (and a little more) from the .ml
From: Francois Berenger
Date: Mon, 03 Jun 2013 11:28
Date: Mon, 03 Jun 2013 11:28
55 lines
4877 bytes
4877 bytes
On 05/31/2013 06:10 PM, Romain Bardou wrote: > I also used to believe the .mli file should be somehow included in the > .ml file. Now I don't. > > But if you design such a tool, here are some things to consider. > > - Using numbers to order stuff creates some issues of scalability. In > particular, inserting a declaration between #3 and #4 may require you to > move #4 to #5, #5 to #6 and so on, which (in particular if everything is > not in the right order in the implementation) can prove more annoying > than reordering stuff in an .mli. This is trivial to solve. > - Even without numbers it will be harder to get the big picture from a > module. I just propose to generate the .mli automatically (for my projects). Not to get rid of them. > An approach I like about this is Pascal units, with an interface > section and an implementation section, in the same file. But it does not > solve the duplication issue. > > - You need a way to specify abstraction. For instance: > * specify that a type should be exported as "type t" instead of "type > t = A | B"; > * specify that a type should be exported as "type t = private A | B" > instead of "type t = A | B"; > * specify that a value should be exported as "val f: t -> t" instead > of "val f: int -> int" > * specify that a value should be exported as "val f: int -> t" instead > of "val f: 'a -> 'a" I did not think about this yet. > Often, people who want automatic .mli generation do not use abstraction, > which is the main point of interfaces. > > - Don't forget that you need to take into account the whole OCaml > language, including objects, modules, polymorphic variants๏ฟฝ It may be > more work than expected. And this project will need to be maintained and > follow the changes to the language. I cannot provide any guarantee, on any of these. Regards, F. -- 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.KMYN8yQHcctsahSCJUKTZKW4ARw@ifi.uio.no>Path:
arc1-ca.pugleaf.net!fw11ni23380wic.0!nntp.google.com!goblin2!goblin3!goblin.stu.neva.ru!newsfeed2.funet.fi!newsfeeds.funet.fi!uio.no!nntp.uio.no!.POSTED!not-for-mailReferences:
<fa.ysPYFL5+u0NnfGu8UBtNleD9SeQ@ifi.uio.no> <fa.OQroQDVDk9br1ZhQEIL1NaakR5I@ifi.uio.no> <fa.bD6TGMY7hcijji7TE20fgVNMYJ0@ifi.uio.no> <fa.kLitjS6+thDvPu069t19jM9fjnc@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,CP1252
X-Received: by 10.180.91.40 with SMTP id cb8mr4681215wib.2.1370258894561;
Mon, 03 Jun 2013 04:28:14 -0700 (PDT)
Path: arc1-ca.pugleaf.net!fw11ni23380wic.0!nntp.google.com!goblin2!goblin3!goblin.stu.neva.ru!newsfeed2.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: Mon, 03 Jun 2013 11:28:14 UTC
Organization: Internet mailing list
Lines: 55
Sender: caml-list-request@inria.fr
Message-ID: <fa.KMYN8yQHcctsahSCJUKTZKW4ARw@ifi.uio.no>
References: <fa.ysPYFL5+u0NnfGu8UBtNleD9SeQ@ifi.uio.no> <fa.OQroQDVDk9br1ZhQEIL1NaakR5I@ifi.uio.no> <fa.bD6TGMY7hcijji7TE20fgVNMYJ0@ifi.uio.no> <fa.kLitjS6+thDvPu069t19jM9fjnc@ifi.uio.no>
NNTP-Posting-Host: mail-jess.uio.no
Mime-Version: 1.0
X-Trace: readme.uio.no 1370258894 15238 129.240.7.9 (3 Jun 2013 11:28:14 GMT)
X-Complaints-To: abuse@uio.no
NNTP-Posting-Date: Mon, 3 Jun 2013 11:28:14 +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,792,1363129200";
d="scan'208";a="20037142"
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: Ak0AAB3yq1GGoCGhhWdsb2JhbABav02CbYEVDgEBAQoLCwUWKIIjAQEEAScLAQVABgsLGAkMCg8JAwIBAgFFEwgBAYgDBrpzjy4KDINCA4keik+DUYYejHqBRg
X-IPAS-Result: Ak0AAB3yq1GGoCGhhWdsb2JhbABav02CbYEVDgEBAQoLCwUWKIIjAQEEAScLAQVABgsLGAkMCg8JAwIBAgFFEwgBAYgDBrpzjy4KDINCA4keik+DUYYejHqBRg
X-IronPort-AV: E=Sophos;i="4.87,790,1363129200";
d="scan'208";a="16508591"
In-Reply-To: <51A868F8.9050101@inria.fr>
X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2013.6.3.12418
X-Sequence: 6865
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: Mon, 03 Jun 2013 10:33:09 +0900
Original-Message-Id: <51ABF255.4010109@riken.jp>
Original-References: <51A81C67.50902@riken.jp> <87bo7rogub.fsf@gmail.com> <51A84283.80309@riken.jp> <51A868F8.9050101@inria.fr>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 8bit