From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id RAA24710 for caml-redistribution; Thu, 12 Sep 1996 17:11:37 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.6.10/8.6.6) with ESMTP id PAA22432 for ; Thu, 12 Sep 1996 15:16:15 +0200 Received: from simon.cs.cornell.edu (SIMON.CS.CORNELL.EDU [128.84.154.10]) by concorde.inria.fr (8.7.1/8.7.1) with ESMTP id PAA24607 for ; Thu, 12 Sep 1996 15:16:10 +0200 (MET DST) Received: from cloyd.cs.cornell.edu (CLOYD.CS.CORNELL.EDU [128.84.227.15]) by simon.cs.cornell.edu (8.7.5/8.7.3/R-1.1) with ESMTP id JAA20253 for ; Thu, 12 Sep 1996 09:16:09 -0400 (EDT) Received: from verdandi.cs.cornell.edu (VERDANDI.CS.CORNELL.EDU [128.84.254.202]) by cloyd.cs.cornell.edu (8.7.5/8.7.3/M-1.2) with ESMTP id JAA07519 for ; Thu, 12 Sep 1996 09:16:07 -0400 (EDT) Received: (from hayden@localhost) by verdandi.cs.cornell.edu (8.7.5/8.7.3/C-1.1) id JAA01731; Thu, 12 Sep 1996 09:16:01 -0400 (EDT) Message-Id: <199609121316.JAA01731@verdandi.cs.cornell.edu> To: caml-list@pauillac.inria.fr Subject: Re: Merging Modules In-reply-to: Your message of "Thu, 12 Sep 1996 11:54:10 +0200." <199609120954.LAA18065@pauillac.inria.fr> Date: Thu, 12 Sep 1996 09:16:01 -0400 From: Mark Hayden Sender: weis >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. I would find it useful if the name of the top module in the source file was not determined by the file name. It would be nice if by default O'caml used the file name as the name for a module, but allowed you to override that with a different name. (This introduces problems because the interface searching assumes the module name is the same as the .cmi file name, but there are ways to get around this.) Here is an example where this would be useful. I have a module x.mli for which I've built several different implementations: x1.ml, x2.ml, x3.ml. In order to compile each implementation with the module name X, I have to (1) copy the module xi.ml to x.ml, (2) compile x.ml to x.cmo, and (3) copy x.cmo to xi.cmo. >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. It would also be useful to allow several top level modules to reside in one implementation file.... I'm thinking of cases where a lot of tiny modules have to reside in separate files in order to use the O'caml module system. Sometimes one would prefer to have the modules all in the same implementation file (for instance, to improve compilation speed). >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 Wouldn't it be better if O'caml included some mechanisms so that these kinds of limitations didn't require hacks with cpp or cat to get around them? I think O'caml is great as it is now, but a few additions to prevent these problems would significantly improve it. --Mark Hayden