Browse thread
[Caml-list] Automatic generation of mli files
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Brian Hurt <brian.hurt@q...> |
| Subject: | Re: [Caml-list] Automatic generation of mli files |
On Fri, 6 Jun 2003, Stefan Heimann wrote: > Hi, > > I searching for a way for generating the .mli file for a given source .ml > file automatically. My basic idea is like that: > > (1) Specify in the .ml file which values and types should be exported > and if a type should be exported abstract or not. This could be > done with a special comment at the top of the file. > > (2) Filter the output of `ocamlc -i' to exclude the values and types > that should not be exported and to make the types abstract if > needed. Not sure what advantage this would gain. Step #1 is about as difficult as simply writting the .mli file directly. Actually, a fairly fast way to produce an mli file is to do ocamlc -i foo.ml > foo.mli and fire up your local text editor and delete everything out of foo.mli you don't want exported. I don't have a problem with .mli files being seperate from .ml files for two reasons: 1) .mli is your external interface- changing that interface generally means changing other files as well. In this case, you're generally already chaging other files. 2) The compiler checks the signature of the .mli file against what is produced by the .ml file, so if you do "accidentally" change an exported function's interface, and forget to change the .mli to match, the compiler will catch it. Brian ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners