Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] OCamlMakefile mly/mll interdependency
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Ville-Pertti Keinonen <will@e...>
Subject: Re: [Caml-list] Re: cyclic modules (was: OCamlMakefile mly/mll interdependency)
> Well, I don't know if it's intensional, but OCaml allows one to have
> cyclic modules if you only use *types*, not values. For example:

 ...

> [malekith@roke t]$ ocamlc -c a.mli
> [malekith@roke t]$ ocamlc -c b.mli
> [malekith@roke t]$ ocamlc -c a.ml 
> [malekith@roke t]$ ocamlc -c b.ml
> [malekith@roke t]$ ocamlc b.cmo a.cmo

This works because a.ml depends on b.mli (b.cmi), which was compiled
before a.ml, but not b.ml (b.cmo).

You still can't have cyclic dependencies between a.mli and b.mli or
a.ml and b.ml.

It doesn't limit the dependency problem because the same effect could
always be achieved by defining the types in a separate module.

For types, it might be easier to actually allow cyclic dependencies,
at least the side-effects ordering problem doesn't apply.  However I
don't think it would fit well with the current compilation model.  As
far as I understand, the compiler never reads source files other than
the one being compiled, all external information is from
.cmi/.cmo/.cmx files.

-------------------
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