[phobos] improved module cycle detection algorithm finds existing cycle in phobos, what to do?

Steve Schveighoffer schveiguy at yahoo.com
Fri Nov 5 10:15:37 PDT 2010


No, the issue is, stdiobase only imports what it needs to do the static 
constructor.  stdio may import other things that have nothing to do with the 
static ctor, but may inadvertently make a cycle.

The theory goes, if there is no true dependency cycle (i.e. two independent 
ctors that depend on eachother to run), then you should be able to split the 
static ctor into its own module.

-Steve



----- Original Message ----
> From: Michel Fortin <michel.fortin at michelf.com>
> 
> Le 2010-11-05 à 12:03, Andrei Alexandrescu a écrit :
> 
> > When  encountering a similar problem I defined stdiobase.d to break the 
>dependency  cycle.
> 
> But then, don't you lose the assurance that stdio's static  variables will be 
>initialized before another module that depends on std.stdio is  initialized? 
>What guaranties that std.stdiobase will be initialized before my  own module? 
>Perhaps I should import std.stdiobase.
> 


      


More information about the phobos mailing list