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

9085Re: "ocaml_beginners"::[] Re: Circular dependencies between modules

Expand Messages
  • Fabrice Marchant
    Dec 1, 2007
    • 0 Attachment
      Thanks a lot RĂ©mi !

      > Well, as I forget this possibility in my late post, I will show you
      > here:
      >
      > For type:
      >
      > you have in one.ml:
      >
      > type t1 =
      > Foo of Two.t2
      > | Bar of int
      >
      > in two.ml
      >
      > type t2 =
      > Fooz of One.t1 * int
      >
      > of course this wont work, but you can do :
      >
      > you have in one.ml:
      >
      > type 'a t1 =
      > Foo of 'a
      > | Bar of int
      >
      > in two.ml
      >
      > type t2 =
      > Fooz of One.t1 * int | Leaf
      >
      >
      > then one can use Foo(Fooz(Bar 10)) : we use parametrization of the
      > first type to break the cycle.
      >
      > In the same way, you could add an argument to a function so instead to
      > depend on value at compile time, it will only need it when evaluated.
      Thanks for this nice illustration of the interesting method Jon spoke about.

      Regards,

      Fabrice
    • Show all 15 messages in this topic