Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] automatic extraction of mli file?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-10-16 (13:13)
From: Claude Marche <Claude.Marche@l...>
Subject: Re: [Caml-list] automatic extraction of mli file?

>>>>> "Yang" == Yang Shouxun <> writes:

    Yang> All the comments will be removed. That is not desirable, for the mli 
    Yang> file is meant to be read by both machine and humans. The humans need the 
    Yang> comments to make sense of the interface file, without reference to the 
    Yang> implementation code.

    Yang> I guess an extension to the ocamlweb is what I mean.

I would not have answered if you did not talk about ocamlweb. But as
one co-author, please let me say that I don't like this
idea. Mainly, because comments you put in a .mli and in the
corresponding .ml should not be the same. in the interface, you
document your module for use by another programmer, whereas the
comments of the implementation should be for explaining your code, your
algorithms, etc.

My advice is: always start a module by writing the .mli. When
prototyping, that usually means that you will add only one value, for
the main function of your module. When I teach ocaml to students, I
always insist on that, because it's better to force you write down
*what* you want to code, before thinking about *how*.  

Then later, you may add to the .mli other functions, exceptions,
etc. and in any case you will both maintain the .mli and the .ml

- Claude

| Claude Marché           | |
| LRI - Bât. 490          |  |
| Université de Paris-Sud | phoneto: +33 1 69 15 64 85  |
| F-91405 ORSAY Cedex     | faxto: +33 1 69 15 65 86    |
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: