From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA27439; Wed, 27 Aug 2003 20:53:53 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA31680 for ; Wed, 27 Aug 2003 20:53:52 +0200 (MET DST) Received: from mail.exomi.com (mail.exomi.com [217.169.64.72]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h7RIrpT09452 for ; Wed, 27 Aug 2003 20:53:51 +0200 (MET DST) Received: from oxy.exomi.com (unknown [10.0.5.5]) by mail.exomi.com (Postfix) with ESMTP id E8AB95D03; Wed, 27 Aug 2003 21:53:50 +0300 (EEST) Received: by oxy.exomi.com (Postfix, from userid 501) id C7B4739F9CA; Wed, 27 Aug 2003 21:53:50 +0300 (EEST) Date: Wed, 27 Aug 2003 21:53:50 +0300 From: Ville-Pertti Keinonen To: caml-list@inria.fr, Jeff Henrikson Subject: Re: [Caml-list] Re: cyclic modules (was: OCamlMakefile mly/mll interdependency) Message-ID: <20030827185350.GB506@exomi.com> Mail-Followup-To: caml-list@inria.fr, Jeff Henrikson References: <20030827100125.GA14764@fichte.ai.univie.ac.at> <20030827182757.GA15479@roke.freak> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030827182757.GA15479@roke.freak> User-Agent: Mutt/1.4i X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 cyclic:01 cyclic:01 malekith:01 ocamlc:01 mli:01 malekith:01 ocamlc:01 mli:01 dependencies:01 dependencies:01 model:01 cmx:01 compiler:01 cmo:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > 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