* Merging Modules
@ 1996-09-06 9:35 Vyskocil Vladimir
1996-09-12 9:54 ` Xavier Leroy
0 siblings, 1 reply; 3+ messages in thread
From: Vyskocil Vladimir @ 1996-09-06 9:35 UTC (permalink / raw)
To: caml-list
Hi,
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 ?
Thanks
---
Vyskocil Vladimir
vvyskoci@sophia.inria.fr
http://www.inria.fr/safir/SAFIR/Vladimir.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Merging Modules
1996-09-06 9:35 Merging Modules Vyskocil Vladimir
@ 1996-09-12 9:54 ` Xavier Leroy
1996-09-12 13:16 ` Mark Hayden
0 siblings, 1 reply; 3+ messages in thread
From: Xavier Leroy @ 1996-09-12 9:54 UTC (permalink / raw)
To: Vyskocil Vladimir; +Cc: caml-list
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Merging Modules
1996-09-12 9:54 ` Xavier Leroy
@ 1996-09-12 13:16 ` Mark Hayden
0 siblings, 0 replies; 3+ messages in thread
From: Mark Hayden @ 1996-09-12 13:16 UTC (permalink / raw)
To: caml-list
>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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1996-09-12 15:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-09-06 9:35 Merging Modules Vyskocil Vladimir
1996-09-12 9:54 ` Xavier Leroy
1996-09-12 13:16 ` Mark Hayden
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox