Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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 
> [malekith@roke t]$ ocamlc -c
> [malekith@roke t]$ ocamlc b.cmo a.cmo

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

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

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 Archives:
Bug reports: FAQ:
Beginner's list: