Re: cyclic dependencies

From: Michael Donat (donat@intergate.bc.ca)
Date: Sat Feb 26 2000 - 23:16:55 MET

  • Next message: Jacques Garrigue: "Re: # types and polymorphic variants"

    I had a similar problem trying to access some (e.g.) print routines in
    another module. My solution probably isn't the most graceful, but instead of
    referencing the print routines directly, I accessed them through a
    reference. The reference is initialized by the module providing the print
    routines.

    In other words:

    To fix

    moduleA:
    ...
    B.print args
    ...

    moduleB:
    ...
    A.something
    ...

    I used

    moduleA:

    pv = ref stub;;
    ...
    !pv args
    ...

    moduleB:
    ...
    A.pv := print;;
    ...
    A.something

    ...

    Of course, module B is really using a subclass of what it's accessing from
    A, so an object approach might be more appealing (and more correct). Since I
    only had two functions to deal with, I found the reference approach
    acceptable.

    Michael Donat
    -----Original Message-----
    From: Juergen Pfitzenmaier <pfitzen@informatik.uni-tuebingen.de>
    To: caml-list@inria.fr <caml-list@inria.fr>
    Date: Friday, February 25, 2000 9:30 AM
    Subject: cyclic dependencies

    >I have a problem with cyclic dependencies between modules. Currently I use
    the polymorphic
    >member functions of OLabl 2.04 to access the classes in other dependent
    modules. But this
    >is no longer possible in OCaml 2.99. Any suggestions what to do ?
    >
    >pfitzen
    >



    This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 00:14:11 MET