Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: cyclic dependencies
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Michael Donat <donat@i...>
Subject: Re: cyclic dependencies
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
>