From: Gerard Huet <Gerard.Huet@inria.fr>
To: dsl@tepkom.ru, caml-list@inria.fr
Subject: Re: automatic construction of mli files
Date: Wed, 02 Aug 2000 16:13:43 +0200 [thread overview]
Message-ID: <200008021416.e72EGWb22873@concorde.inria.fr> (raw)
In-Reply-To: <Pine.LNX.4.10.10008011518300.14334-100000@post.tepkom.ru>
At 16:03 02/08/00 +0400, Dmitri Lomov wrote:
>There are some things that I DO NOT like about OCaml .mli/.ml files, however.
>1) I have to duplicate type definitions in .mli and in .ml files.
> I think every ocamler knows how tedious is keeping consistency here.
> Most of the time, you just change the definition in one of the files,
> compile, get an error message, and (with curses ;)) copy definition to
another
> file. I suppose complier can do this work for the user.
> Maybe there is some hidden philosophy behind this... I will be happy
> if someone explaint it to me
Just to add my 2 cents to this rambling discussion on interfaces. I used to
gripe myself about this duplication problem. But one day I realised that a
lot of this duplication could be avoided, because often the interfaces can
be designed as pieces of data structures definitions (DTDs), which consist
entirely of type declarations AND WHICH DO NOT NEED AN IMPLEMENTATION FILE
AT ALL, and pieces of method/exceptions descriptions, for which a .mli and
a .ml file share some redundancy, but where the programmer has the
opportunity to think carefully about what is visible from outside and at
what level of abstraction.
Furthermore it is essential that we provide the possibility of designing
the interface BEFORE the code gets written, in order to do team work and
top-down design. For a large project, dummy implementations will typically
give a debugging environment to test your module, but here we want to check
the type consistency of these debugging dummies with respect to the master
.mli, as opposed to generate the .mli specs from them.
I am currently working on a linguistic data base, where the data base
format is a BIG .mli describing the abstract syntax of my data base,
thinking about it as a DTD. This format is used as interface both to the
parser which reads in the data, and to the various processors, extractors,
and printers of the data base. This .mli file has no implementation
associated with it, and thus there is not any redundancy in terms of source
code.
Of course, it is useful to have the facility to get the .mli from the .ml
for quick-and-dirty bottom-up programming. But as your program gets large,
and your modules become parametric functors, you really want to keep
separate your interface specs and your code, and the redundancy is slight.
Gérard
next prev parent reply other threads:[~2000-08-03 13:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-07-24 5:34 Julian Assange
2000-07-24 20:48 ` Olivier Andrieu
2000-07-26 16:03 ` John Max Skaller
2000-07-24 22:02 ` Jean-Christophe Filliatre
2000-07-26 16:09 ` John Max Skaller
2000-07-24 22:09 ` John Prevost
2000-07-24 23:14 ` David Brown
2000-07-25 1:13 ` Jacques Garrigue
2000-08-01 11:22 ` Anton Moscal
2000-08-02 12:03 ` Dmitri Lomov
2000-08-02 14:13 ` Gerard Huet [this message]
2000-07-25 11:48 ` Hendrik Tews
2000-07-26 10:16 ` David Delahaye
2000-07-26 12:58 Damien Doligez
2000-07-27 17:46 ` Francois Rouaix
2000-07-27 19:04 Damien Doligez
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=200008021416.e72EGWb22873@concorde.inria.fr \
--to=gerard.huet@inria.fr \
--cc=caml-list@inria.fr \
--cc=dsl@tepkom.ru \
/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