caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Cross Modules
@ 2002-04-16 11:21 Warp
  2002-04-16 13:39 ` Hendrik Tews
  0 siblings, 1 reply; 2+ messages in thread
From: Warp @ 2002-04-16 11:21 UTC (permalink / raw)
  To: OCaml

Hi all
I'm currently working on a ocaml program that will enable automatic
compilation of ocaml projects.
After making dependencies, I'm bumping in the following problem :

If you got two modules A and B (both having ml+mli files) and if A calls a
function of B and B calls a function of A then linking is impossible ( both
ocamlc a.cmo b.cmo & ocamlc b.cmo a.cmo will fail ).
But if for example A call a function of B which returns a type declared in A
interface, then you have to call "ocamlc b.cmo a.cmo" and it'll works.

Watching depencies generated by ocamldep, you can't really know in which
case you are, because each time you have :
a.cmo : b.cmi
b.cmo : a.cmi

And sometimes it can be "legal", and some other times not.
I think it would be nice to have either ocamlc sort itself the cmo in the
right order, and raise an error when theses cannot be link, or to have
ocamldep telling us a little more (with some flag turn on) by adding the
.cmo in the dependencies list when there is functions called.

Since now I've written a quite simple algorithm that suppose you're using a
"correct" design so both cases presented in this mail are rejected by
automatic compilation.

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] 2+ messages in thread

* Re: [Caml-list] Cross Modules
  2002-04-16 11:21 [Caml-list] Cross Modules Warp
@ 2002-04-16 13:39 ` Hendrik Tews
  0 siblings, 0 replies; 2+ messages in thread
From: Hendrik Tews @ 2002-04-16 13:39 UTC (permalink / raw)
  To: Warp; +Cc: OCaml

Warp writes:
   Date: Tue, 16 Apr 2002 13:21:27 +0200
   Subject: [Caml-list] Cross Modules
   
   [...]
   But if for example A call a function of B which returns a type declared in A
   interface, then you have to call "ocamlc b.cmo a.cmo" and it'll works.
   
See problem report #562 for a related issue (at
http://caml.inria.fr/bin/caml-bugs/not%20a%20bug?id=562;expression=tews;user=guest).

I think the moral is that you should accept ocamldep's output as
official. If you get

   a.cmo : b.cmi
   b.cmo : a.cmi
   
then the modules are circular and you should raise an error.

Bye,

Hendrik
-------------------
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] 2+ messages in thread

end of thread, other threads:[~2002-04-16 13:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-16 11:21 [Caml-list] Cross Modules Warp
2002-04-16 13:39 ` Hendrik Tews

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