caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Modules Order
@ 2002-04-18 14:01 Warp
  2002-04-18 14:24 ` Christian Lindig
       [not found] ` <15550.55633.886446.494339@paille.inria.fr>
  0 siblings, 2 replies; 7+ messages in thread
From: Warp @ 2002-04-18 14:01 UTC (permalink / raw)
  To: OCaml

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-04-18 21:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-18 14:01 [Caml-list] Modules Order Warp
2002-04-18 14:24 ` Christian Lindig
2002-04-18 14:31   ` Michal Moskal
2002-04-18 14:40     ` Christian Lindig
2002-04-18 14:45       ` Michal Moskal
     [not found] ` <15550.55633.886446.494339@paille.inria.fr>
2002-04-18 14:41   ` Warp
2002-04-18 20:55     ` John Max Skaller

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