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-12 (11:32)
From: Nicolas Cannasse <warplayer@f...>
Subject: Re: [Caml-list] automatic extraction of mli file?
> What I'm wondering is "wouldn't it be preferrable to automatically
> produce the interface file from the implementation file?", so that we
> can program in the literate programming style, do prototyping, and save
> the drudgery of writing the interface (though a little manual editing
> may be necessary, or some kind of markup in the source code).
> Maybe such utility already exists. Only I'm not aware of. If so, I'd
> like to know how to get it.

The "-i" ocamlc compiler flag is what you need.
It prints all the types found in the ML file.
But since there is no rule for interface exclusion, you have to maintain
separatly both ML & MLI files.

For example, if you start working on a new module, you can start writing it
without any interface ( then all members are "public" ) and after some
testing you write the interface and that way ensure that your implemenation
match exactly what's in your mind ( not always obvious :)

Nicolas Cannasse

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: