On 10.03.2010 0:57, Walter Bright wrote:

The circular module thing is usually a result of static constructors in
each of two modules that import each other. There are many solutions to
this, such as switching to lazy initialization, moving the
initializations to a 3rd module, having the initialization done by a
function called explicitly from main(), etc.



Mixed-in state that requires static initialization is a problem. Neither of the solutions you have listed seems to work well in that scenario:

1. Access to the lazily initialized data must be synchronized, which is not always a way to go.

2. A third module cannot be used. At least, we haven't been able to figure out how to do that. Probably, something could be hacked up if this bug (feature) is fixed http://d.puremagic.com/issues/show_bug.cgi?id=2671

3. Forcing the user to initialize each mixed-in piece manually is a potential source of grievance.

Reply via email to