Browse thread
automatic construction 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: | Jean-Christophe Filliatre <filliatr@c...> |
| Subject: | Re: automatic construction of mli files |
> .mli files are highly redundant. Almost without exception all, or at > the vast majority of .mli information can be generated from the > underlying .ml implementation. We have programming languages to reduce > redundancy, not increase it. [...] We probably don't use interfaces (.mli files) in the same way. Personally, I write the interface *before* the code. It clarifies the design of an implementation, helping you focusing first on the features of the module, independently of the way you will write it. Therefore, there is no way of generating the .mli from the .ml, since it comes first. Moreover, I don't put the same kind of documentation in the interface and in the code: in the interface I put specifications, mainly, and in the code I put implementation details. In the extreme situation where there is no real need for writing an interface, you can either simply not write one (this is not mandatory) or generate it from the code with "ocamlc -c -i". But writing an interface is always a good idea, since it encourages you to abstract data types and to provide only small and orthogonal sets of functions, which cannot be done automatically in most cases. -- Jean-Christophe Filliatre Computer Science Laboratory Phone (650) 859-5173 SRI International FAX (650) 859-2844 333 Ravenswood Ave. email filliatr@csl.sri.com Menlo Park, CA 94025, USA web http://www.csl.sri.com/~filliatr