caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Anthony Tavener <anthony.tavener@gmail.com>
To: Francois Berenger <berenger@riken.jp>
Cc: "Daniel Bünzli" <daniel.buenzli@erratique.ch>,
	caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Why should I use .mli files?
Date: Mon, 29 Oct 2012 21:26:09 -0600	[thread overview]
Message-ID: <CAN=ouMTMQ8tO1mXP=4-BU4bz49HH82w5hD9xBLaSeJXJL7Bq6w@mail.gmail.com> (raw)
In-Reply-To: <508F3D3D.3070600@riken.jp>

[-- Attachment #1: Type: text/plain, Size: 3324 bytes --]

Hi Francois,

To add a different perspective, I usually start without mli files. I do
this for one of the reasons you give: leaving most typing up to inferencing.

But parts of my code move into the realm of libraries which are reused, and
here I'll make the mli files concrete. This aids in pinning down type
errors where they really are, forms a kind of documentation, and provides a
nice abstract view of a module suitable for functors.

When you pin down some types, it gives the type system more info to help
you, the programmer. So if you have a module which is fairly concrete and
not likely to change -- specifying the exact signature in an mli can
identify erroneous usage of this module, rather than throwing a more
obscure type error because the inference can't know if the problem is in
the module you're using or the way it's used.

If you are writing small programs and not much reused library-like code,
then you really might not benefit from explicit mli files. They can be a
minor pain, since you have to update them with additions or changes of the
corresponding ml.

Overall, mli's have their place, but I'm glad OCaml has implicit mli
files... so that in cases where they aren't needed, you can ignore them!

-Tony


On Mon, Oct 29, 2012 at 8:36 PM, Francois Berenger <berenger@riken.jp>wrote:

> On 10/30/2012 10:19 AM, Daniel Bünzli wrote:
>
>> Le mardi, 30 octobre 2012 à 01:43, Francois Berenger a écrit :
>>
>>> Also, maybe I only work on toy-size OCaml projects. So, I never
>>> bothrered to create any .mli file.
>>> I would like to know if I should bother about them.
>>>
>>
>> For me, a program that lacks mli files means lack of design, abstraction
>> and documentation and hence equates with rubbish.
>>
>
> Thanks for the compliment.
>
> To my defence, my main programming goal because of my employer
> and colleagues is to deliver fast and correct (software) in order to
> investigate research ideas.
> We don't deliver libraries or things targeting at a wide developer
> audience (we don't do research in computer science, also).
>
>
>  For example at a certain point you (or others) will read your code.
>>
>
> I don't have any problem reading my code.
> It reads like an English text usually.
>
>
> >At that moment simple things like being able to distinguish between
> functions/types that are local to a module and those that are used by other
> part of the program is immensely useful.
>
> Well, if I want to know this, I change the function parameters
> and let the compiler tell me where it was used with the initial parameters.
> I also quite know my swiss knives (egrep and co).
>
>
> > And that's only one of the purpose of mli files.
>
>>
>> In fact mli files are the first thing I write when I design programs.
>>
>
> OK, so you too are a top-down design practitioner
> and use .mli files to this end.
>
> Thanks,
> F.
>
>
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/**arc/caml-list<https://sympa.inria.fr/sympa/arc/caml-list>
> Beginner's list: http://groups.yahoo.com/group/**ocaml_beginners<http://groups.yahoo.com/group/ocaml_beginners>
> Bug reports: http://caml.inria.fr/bin/caml-**bugs<http://caml.inria.fr/bin/caml-bugs>
>

[-- Attachment #2: Type: text/html, Size: 4513 bytes --]

  reply	other threads:[~2012-10-30  3:26 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-30  0:43 Francois Berenger
2012-10-30  1:04 ` Peter Groves
2012-10-30  2:21   ` Francois Berenger
2012-10-30  1:15 ` malc
2012-10-30  2:24   ` Francois Berenger
2012-10-30 10:23     ` malc
2012-10-30  1:19 ` Daniel Bünzli
2012-10-30  2:36   ` Francois Berenger
2012-10-30  3:26     ` Anthony Tavener [this message]
2012-10-30 12:28     ` Daniel Bünzli
2012-10-31  0:53       ` Francois Berenger
2012-10-30  2:21 ` gallais @ ensl.org
2012-10-30  6:12 ` Anton Lavrik
2012-10-30  9:18   ` Francois Berenger
2012-10-30 10:01     ` Malcolm Matalka
2012-10-30 11:03     ` Richard W.M. Jones
2012-10-30 11:41     ` [Caml-list] " Hongbo Zhang
2012-10-30 13:31       ` Romain Bardou
2012-10-31  1:03         ` Francois Berenger
2012-10-31  1:44           ` Daniel Bünzli
2012-10-31  9:51             ` Oliver Bandel
2012-10-30 14:32   ` [Caml-list] " Oliver Bandel
2012-10-30 14:45     ` Anton Lavrik
2012-10-30 14:49       ` Oliver Bandel
2012-10-30 14:51       ` Didier Cassirame
2012-10-30 14:47     ` Romain Bardou
2012-10-30 16:06       ` Edgar Friendly
2012-10-30 16:21         ` Romain Bardou
2012-10-30 16:46           ` Edgar Friendly
2012-10-30 21:25             ` Gabriel Scherer
2012-10-30 22:18               ` Oliver Bandel
2012-10-31  9:25                 ` Gabriel Scherer
2012-10-31  9:59                   ` Daniel Bünzli
2012-10-31 13:22                     ` Edgar Friendly
2012-10-31 13:38                       ` Daniel Bünzli
2012-10-31 13:55                         ` Edgar Friendly
2012-10-31 13:43                       ` Gabriel Scherer
2012-11-01  0:38                         ` Francois Berenger
2012-11-01  0:42                           ` Edgar Friendly
2012-11-01  0:52                             ` Francois Berenger
2012-11-01  2:06                               ` Edgar Friendly
2012-11-01  2:37                                 ` Francois Berenger
2012-11-01  2:44                                 ` Jacques Garrigue
2012-11-01  7:45                                   ` Andreas Rossberg
2012-10-31 10:20               ` Alain Frisch
2012-10-31 13:50               ` Edgar Friendly
2012-10-31 15:12                 ` Gabriel Scherer
2012-10-31 16:48                   ` Edgar Friendly
2012-10-31 17:15                     ` Gabriel Scherer
2012-10-31 19:05                       ` Tiphaine Turpin
2012-10-30  7:43 ` Mike Lin
2012-10-30 15:52 ` Didier Cassirame
2012-10-30 15:56   ` Romain Bardou
2012-10-30 16:14     ` Didier Cassirame
2012-10-31 21:30   ` Oliver Bandel
2012-11-01 15:26     ` Didier Cassirame
2012-10-31 15:32 ` Alain Frisch
2012-10-31 17:32   ` Tiphaine Turpin
2012-10-31 21:40     ` Oliver Bandel
     [not found] <fa.4zzWyGZIo+GsGOz7cSC34yWTunY@ifi.uio.no>
2012-10-31 14:32 ` Radu Grigore
     [not found] ` <fa.pEEaqh4bLDLiRdYkCRHvi9787TQ@ifi.uio.no>
     [not found]   ` <fa.JtZOlOTbNCp6rOoRnHhKEARwLDQ@ifi.uio.no>
     [not found]     ` <fa.s4gDOdOTZVbthjceZ5OEMxHiH90@ifi.uio.no>
     [not found]       ` <fa.rfsHI3X48Zri1S2pu1SEFowmDZg@ifi.uio.no>
     [not found]         ` <fa.KulHINoVpgjN1uI63QvwcxoNuiY@ifi.uio.no>
2012-11-01 11:38           ` Radu Grigore

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='CAN=ouMTMQ8tO1mXP=4-BU4bz49HH82w5hD9xBLaSeJXJL7Bq6w@mail.gmail.com' \
    --to=anthony.tavener@gmail.com \
    --cc=berenger@riken.jp \
    --cc=caml-list@inria.fr \
    --cc=daniel.buenzli@erratique.ch \
    /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;
as well as URLs for NNTP newsgroup(s).