Version française
Home     About     Download     Resources     Contact us    
Browse thread
Module hierarchies
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Michael Hicks <mwh@d...>
Subject: RE: Module hierarchies
> I am wondering how a large OCaml project might be structured, specifically
> in terms of directories and files.  I see that the OCaml compiler is
> structured as a one-level collection of directories, with the Makefile
> drawing them all together.  There's no hierarchy here; the directory
> structure is used to partition major components of the system.

In my experience with Ocaml (two projects of 10's of thousands of lines of
code), typically one or two levels of hierarchy has been sufficient, tied
together with a single Makefile or "included" sub-Makefiles, and judicious
use of -I to get all of the dependencies right.  For a while, we used
"recursive" make, having separate makefiles in each subdirectory, but then
realized that this can lead to (and did, in our case) lots of unnecessary
recompilation---see "Recursive Make considered Harmful"
(http://www.pcug.org.au/~millerp/rmch/recu-make-cons-harm.html) for more on
this, and good suggestions for structuring large projects.

> I'm used to thinking about breaking large projects down into smaller and
> smaller hierarchical subcomponents.  I think the Java mapping between
> package structure and directory structure helps, and I wonder whether
> something similar could be useful for OCaml?

I personally don't like the Java notion packages being so tightly tied to
the filesystem, as it makes components less reusable: if you move where your
package is, you have to go change all of the other files that reference it;
in Ocaml, you can just change -I to point where you want.

Mike