On Sat, Mar 22, 2003 at 04:52:13PM -0800, brogoff@speakeasy.net wrote: > On Sat, 22 Mar 2003, Michal Moskal wrote: > > Use example_types.mli and example.ml/mli. AFAIR you can only put types > > in example_types, not even exceptions. > > And making that example_types.ml instead of .mli will allow exceptions (and > values!), but I'd prefer having a pure .mli file as you suggest, and just > creating a fourth file example_exns.ml for any example exceptions. Just for completeness, here is another trick: when you are using a literate programming tool like NoWEB you can let it do the code duplication: the file foo.nw contains both interface and implementation as named chunks, plus some documentation. A named chunk <> that contains code shared between interface and implementation can be referenced from both. When foo.mli and foo.ml are extracted from foo.nw for compilation, all references are resolved and the shared code shows up in both. <>= type foo = (* large, shared concrete type *) <>= <> (* other abstract types, function signatures *) <>= <> (* rest of implementation *) @ In comparison, this approach goes the opposite way: instead of having more source files, have just one *.nw file that allows internal references for code chunks. -- Christian -- Christian Lindig http://www.eecs.harvard.edu/~lindig/