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] Functorizing large collections of modules
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-03-20 (09:09)
From: Francois Pottier <francois.pottier@i...>
Subject: Re: [Caml-list] Functorizing large collections of modules


Yaron M. Minsky writes:
> The solution suggested below clearly works, but it's just as clearly a
> bit of a hack.

You want Foo and Bar to exist within separate files, even though they are both
parameterized by the same module ZZp. This is, I believe, a frequent problem
for people trying to program in a modular way. It seems that, if you insist
that Foo and Bar should be separately compilable, then you must describe their
interface to the compiler, which means you must turn each of them into a
functor, parameterized over ZZp. This leads you to the solution that was
posted, which, I believe, is manageable to a certain degree. Now, if on the
other hand, you don't really care about separate compilation of Foo and Bar,
then you can place them in separate files, and have your Makefile
automatically catenate them for compilation. Given the speed of today's
machines, this solution should be acceptable in many cases. I don't know of a
third solution, but of course, I'd love to stand corrected.

> Another example of this weakness is the lack of support for namespaces.

It is true that O'Caml has little support for resolving name conflicts
in a modular way, because the semantics of the module language is too
intimately tied with the underlying file system. I suppose a CM-like tool
would help, but I think this issue is separate from the one above.

François Pottier
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: