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 QAA23909; Thu, 18 Apr 2002 16:02:12 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA23905 for ; Thu, 18 Apr 2002 16:02:12 +0200 (MET DST) Received: from relay-1m.club-internet.fr (relay-1m.club-internet.fr [194.158.104.40]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g3IE2Bb00437 for ; Thu, 18 Apr 2002 16:02:11 +0200 (MET DST) Received: from warp (lns02m-2-104.w.club-internet.fr [212.194.13.104]) by relay-1m.club-internet.fr (Postfix) with SMTP id 9F34C16F2 for ; Thu, 18 Apr 2002 16:02:09 +0200 (CEST) Message-ID: <00a501c1e6e1$8c910970$3900a8c0@warp> From: "Warp" To: "OCaml" Subject: [Caml-list] Modules Order Date: Thu, 18 Apr 2002 16:01:33 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi all, In my last post, I was talking about finding the good order for CMO-linking when you only got ocamldep output. I've think about it, and here's some results, please let me know if there is another/better way. First of all, the main problem is CMOs have to be linked in the "right" order, so, if A is calling a function into B, B.cmo has to be passed before A.cmo in ocamlc arguments. When you got the following : A.cmo : A.cmi B.cmi B.cmo : B.cmi A.cmi You can't really choose which one of A or B is the first, that's where there is a "cross". Now if you have A.cmi : B.cmi Then you can say that maybe some function of A is using a type of B. So if the user doesn't make real cross calls, then you can put A before B because B is perhaps calling A ) And if you have both : A.cmi : B.cmi B.cmi : A.cmi Then that's an user design issue :) Now , let's back to the first sample ( without any dependency between CMIs ). If A and B are not then only modules, than there is a way to "guess" the order. - First you got your depency tree, composed of ML & MLI files. You need to add an ML -> ML link when you got a dependency ML -> MLI . If you omit "supposed crossing" modules ( A & B ) then you're not making any cycle in you dependency tree. - Now you try to add the link A.ml -> B.ml , and if that link create a cycle, then you can say that there is already a way to reach A from B, so you can guess/hope that the user have a valid design so you have to put A.cmo before B.cmo and then the conflict is resolved - if none of the A.ml -> B.ml & B.ml -> A.ml links create a cycle, then you can't say anything.... ( flip a coin, so linking should work at least 50% of the time :) Now I would like to generalize this algorithm with N-crossing-modules. If anyone got some idea... Nicolas Cannasse ------------------- 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