Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Francois Berenger <berenger@riken.jp>
To: caml-list@inria.fr
Subject: Re: [Caml-list] automatic extaction of the .mli (and a little more) from the .ml
Date: Mon, 03 Jun 2013 10:33:09 +0900	[thread overview]
Message-ID: <51ABF255.4010109@riken.jp> (raw)
In-Reply-To: <51A868F8.9050101@inria.fr>

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.


  reply	other threads:[~2013-06-03 11:05 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-31  3:43 Francois Berenger
2013-05-31  5:31 ` Malcolm Matalka
2013-05-31  6:26   ` Francois Berenger
2013-05-31  9:10     ` Romain Bardou
2013-06-03  1:33       ` Francois Berenger [this message]
2013-06-04  7:53       ` David Allsopp
2013-06-04  8:22         ` Alain Frisch
2013-06-04  8:54           ` David Allsopp
2013-06-04  8:22         ` Romain Bardou
2013-06-04  9:05           ` David Allsopp
2013-05-31 23:13     ` oliver
2013-06-03  1:28       ` Francois Berenger
2013-06-03 12:01         ` Malcolm Matalka
2013-05-31 15:21   ` [Caml-list] " Hongbo Zhang
2013-05-31 15:42     ` Yaron Minsky
2013-05-31 23:20       ` Jacques Le Normand
2013-06-01  9:12     ` Florent Monnier
2013-06-03 17:12 ` [Caml-list] " Alain Frisch
2013-06-04  0:30   ` Francois Berenger
2013-06-04  8:36     ` Alain Frisch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51ABF255.4010109@riken.jp \
    --to=berenger@riken.jp \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox