caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Ville-Pertti Keinonen <will@exomi.com>
To: caml-list@inria.fr, Jeff Henrikson <jehenrik@yahoo.com>
Subject: Re: [Caml-list] Re: cyclic modules (was: OCamlMakefile mly/mll interdependency)
Date: Wed, 27 Aug 2003 21:53:50 +0300	[thread overview]
Message-ID: <20030827185350.GB506@exomi.com> (raw)
In-Reply-To: <20030827182757.GA15479@roke.freak>

> 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


  reply	other threads:[~2003-08-27 18:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-26  0:40 [Caml-list] OCamlMakefile mly/mll interdependency Jeff Henrikson
2003-08-27 10:01 ` Markus Mottl
2003-08-27 18:27   ` [Caml-list] Re: cyclic modules (was: OCamlMakefile mly/mll interdependency) Michal Moskal
2003-08-27 18:53     ` Ville-Pertti Keinonen [this message]
2003-08-27 19:03       ` Ville-Pertti Keinonen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030827185350.GB506@exomi.com \
    --to=will@exomi.com \
    --cc=caml-list@inria.fr \
    --cc=jehenrik@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).