[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Circular build dependencies



On 28 Feb 2012, at 15:18, Sebastian Probst Eide wrote:
> The problem was as follows:
> 
> server.ml used signal.ml for signalling
> signal.ml would instantiate serverSignalling.ml as functor functionality, to 
> get server specific handling of RPCs.
> serverSignalling.ml would in turn invoke methods in nodes.ml to update system 
> state.
> nodes.ml uses signal.ml to send out RPCs.
> 
> Hence the circular dependency:
> ... signal > serverSignalling > nodes > signal ...
> 
> At the moment, after some discussion with Haris, I have solved it by 
> splitting up the signalling behaviour:
> RPCs are now sent through the nodes module, and only incoming RPCs are 
> handled by a SignallingHandler.
> Since sending an receiving are now dealt with separately, there is no longer 
> a circular dependency.
> 

Yeah, that's a design issue. Think carefully about the purpose of every module, 
and what its
desired interface can be. OCaml does support recursive modules if absolutely 
required, but the
cases where they are needed are vanishingly small and obscure.

In this case, it sounds like the serverSignalling functor is in the wrong 
place. Easiest way is
just to draw up the dataflow of all the components on a whiteboard, and the 
module set falls out
of it.

-anil




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.