Browse thread
[Caml-list] Programming with modules
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Richard Jones <rich@a...> |
| Subject: | Re: [Caml-list] Programming with modules |
On Fri, Aug 20, 2004 at 09:28:18PM +1000, Erik de Castro Lopo wrote:
> Hi all,
>
> Say I have a module (main.ml) and an interface (main.mli) which
> defines a type maintype.
>
> However, main.ml is getting a little large and I'd like to split
> some of the functionality out into another file, but still have
> access to maintype in the new file. Unfortunately, Ocaml doesn't
> allow mutual dependancies across acoss files.
>
> Does anybody have any suggestions on how to get around this?
Preprocessing with /lib/cpp is possible:
-------------------------------------------------- main.ml
#include "main-part1.ml"
#include "main-part2.ml"
-------------------------------------------------- main-part1.ml
let v1 = 1
-------------------------------------------------- main-part2.ml
let v2 = v1 + 1;;
print_endline ("v2 = " ^ string_of_int v2);;
$ ocamlc -pp /lib/cpp main.ml
$ ./a.out
v2 = 2
Rich.
--
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
C2LIB is a library of basic Perl/STL-like types for C. Vectors, hashes,
trees, string funcs, pool allocator: http://www.annexia.org/freeware/c2lib/
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners