9084Re: "ocaml_beginners":: Circular dependencies between modules
- Dec 1, 2007Thanks for your answer,
> > > - Jon : Having big cyclic dependencies is a bad idea anyway...There is a "viewer" file module in this project : it is a movable an "zoomable" window on a universe computed by another file
> > Ah ! I wondered whether the need of such cyclic dependency didn't reveal some misconception.
> Jon's right. It'd be interesting to know what code you think needs
> circular dependencies.
module called "automaton". This automaton is responsible of any modification of the universe. Another file module "controller" allow the user to control the automaton actions and the parameters of the viewer.
Due to their relative dependencies, the file modules ( among others ) appear in this order :
automaton.ml viewer.ml controller.ml
Up to now, no problem.
But here comes a trial to add a new possibility :
The user can decide via the controller to restrict existing universe, cutting it to objects that belong to the current visible view.
This request must be sent to the automaton - that now needs information about the zone of the universe that is currently viewed.
But the automaton cannot access to the viewer internals.
As in Jon's method, it would be possible to do the job with a module that depends on automaton and viewer : for example the controller. However this controller wasn't intended to access such kind of data and I would feel odd to add another module that would retrieve info from viewer to give them to the automaton.
I would prefer that the automaton simply fetch what it needs inside the viewer.
> I've rarely come across any, and each time itIt's up to you to say whether if this above case is completely faulty or if it has a chance to fall in Rémi Vanicat possible "way to go".
> turned out to be my faulty thinking.
- << Previous post in topic Next post in topic >>