caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Warp" <warplayer@free.fr>
To: "OCaml" <caml-list@inria.fr>
Subject: [Caml-list] Modules Order
Date: Thu, 18 Apr 2002 16:01:33 +0200	[thread overview]
Message-ID: <00a501c1e6e1$8c910970$3900a8c0@warp> (raw)

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


             reply	other threads:[~2002-04-18 14:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-18 14:01 Warp [this message]
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

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='00a501c1e6e1$8c910970$3900a8c0@warp' \
    --to=warplayer@free.fr \
    --cc=caml-list@inria.fr \
    /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).