Cyclic depency with class static ctor

Carlos Santander csantander619 at gmail.com
Thu Oct 26 17:43:51 PDT 2006


Frits van Bommel escribió:
> Frank Benoit (keinfarbton) wrote:
> 
>> Now I have these 300+ ported classes, in 300+ modules. And they import
>> each other and many of them have a static ctor. What can I do? How can I
>> resolve the problems?
>>
>> I can think of the possibility to replace all "static this()" with a
>> "public static void static_this()" and make a global module where i call
>> all these ctor in a manual defined order. Is that the way to go?
> 
> If you want to go this way, remember you don't have to do this for *all* 
> modules, just the ones involved in a cyclic dependency whose static 
> constructors don't depend on the other ones having been run yet.

To get a bit of help with this, check out dimple: http://www.shfls.org/w/d/dimple/
The generated graphic shows cyclic dependencies. However, I don't know how well 
it works with some of the recent additions to D (static import, etc.)

-- 
Carlos Santander Bernal



More information about the Digitalmars-d mailing list