> On 03/22/2011 02:12 AM, Nick Sabalausky wrote: > > I'm intending this thread as somewhat of a roundtable-like discussion. > > Hopefully we can come up with good material for a short article on > > Wiki4D, or maybe the D website, or wherever. > > > > The scenario: A coder is writing some D, compiles, runs and gets a > > "Cyclic dependency in static ctors" error. Crap! A pain for experienced > > D users, and very bad PR for new D users. (Hopefully we'll eventually > > get some sort of solution for this, but in the meantime D users just > > have to deal with it.) > > > > The question: What now? What strategies do people find useful for dealing > > with this? Any specific "first steps" to take? Best practices? Etc. > > One commonly used hack is to move static constructors into a separate > helper module and call the initialization function via a C extern (like > it is done in std.stdiobase):
That's what Phobos does to solve the problem (std.stdiobase being only one of the places that it does it). It's likely the solution that I would use as well. - Jonathan M Davis