Re: Merging Modules

Xavier Leroy (xleroy@pauillac.inria.fr)
Thu, 12 Sep 1996 11:54:10 +0200 (MET DST)

From: Xavier Leroy <xleroy@pauillac.inria.fr>
Message-Id: <199609120954.LAA18065@pauillac.inria.fr>
Subject: Re: Merging Modules
To: Vladimir.Vyskocil@sophia.inria.fr (Vyskocil Vladimir)
Date: Thu, 12 Sep 1996 11:54:10 +0200 (MET DST)
In-Reply-To: <199609060935.LAA01708@psyche.inria.fr> from "Vyskocil Vladimir" at Sep 6, 96 11:35:16 am

> I have a simple question : can I merge two or more implementation
> files and get only one module (because in the standard case, each
> file define a new module). I want to split a module implementation
> into several files, is it possible ?

The Caml language does not support this. In Objective Caml, you can
have several sub-modules in one input file, but still all the source
code for the top module must reside in one source file.

A possibility is to compile each file as a distinct module (M1, M2, ...),
then have one extra file/module M that re-exports what is made public
to the remainder of the program, which then refers only to M. This is
exemplified in the Caml Light user's manual, chapter on camllibr.

Another possibility is to generate the module implementation from
several input files in your Makefile, using "cat", "cpp", or whatever
external tool does the job.

Regards,

- Xavier Leroy