Loading ...
Sorry, an error occurred while loading the content.

9062Circular dependencies between modules

Expand Messages
  • Fabrice Marchant
    Nov 30, 2007
    • 0 Attachment
      Hi !

      I'm ashamed not to have grasped this yet. Moreover it's pretty sure this subject was already discussed - but can't find again where.
      So, the basic question :

      In a Makefile - that uses OCamlMakefile in my case - the list of .ml sources was specified like this :

      SOURCES = zero.ml one.ml two.ml three.ml

      the order is meaningful and - forgetting .mli interface restrictions - one.ml can access 'Zero.' things but not 'Two.' neither 'Three.' file modules belongings.

      The problem that arises is :
      one.ml now needs to access a three.ml component.
      But three.ml depends on two.ml and
      two.ml depends on one.ml, thus I can't reorder the sources name.

      I believed that defining the .mli files could solve this kind of problem in some cases. ( I originally waited for having completed the small project before to generate/restrict/document the .mli interfaces. )
      However, I'm not able to solve this mutual dependencies question this way here.

      There are workarounds ( I've even written an ugly one in order not to let my build stuck ) but I hope to learn what would be a clean way to perform this.


    • Show all 15 messages in this topic