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

Re: Circular build dependencies



> You can declare the signatures in a .mli file, and use those independently of 
> the .ml,
> and it should "just work" in ocamlbuild.
Good idea!
I will start using *.mli more extensively.

> A more common but subtle problem is having many sub-modules, and the wrong one
> being picked up from the file-system due an incorrect scope (i.e. a bug), and 
> that 
> shows up a circular dependency.  Try to use unique module names to avoid this 
> sort
> of situation, as the code is less obtuse like that anyway.
Thanks for the tip!

> Could you describe your specific problem in more detail?
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.

Kind of nasty though...

~ Sebastian

> 
> -anil
> 
> On 28 Feb 2012, at 14:12, Sebastian Probst Eide wrote:
> 
>> Dear OCamlers and miragers.
>> 
>> I seem to be spending more time fighting circular build dependencies than 
>> writing code.
>> Is there a way to have the compiler work around these?
>> It might be a sign of bad design, but it regardless, it is just bloody 
>> annoying!
>> 
>> ~ Sebastian
> 




 


Rackspace

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