QtD 0.1 is out!

Eldar Insafutdinov e.insafutdinov at gmail.com
Fri Feb 27 10:48:19 PST 2009


Walter Bright Wrote:

> Jarrett Billingsley wrote:
> > On Fri, Feb 27, 2009 at 12:36 PM, Eldar Insafutdinov 
> > <e.insafutdinov at gmail.com> wrote:
> >> We faced a bug that module static constructors don't work with
> >> cyclic imports. Currently it's fixed with a dirty hack which is not
> >> really acceptable. Is there any chance for this to be fixed?
> >> 
> > 
> > I'll save Walter the trouble: come up with a reproduceable testcase
> > if you haven't already.  It won't get fixed it he can't tell what the
> >  problem is.
> 
> 
> I'll add to that my experience is that if the test case is incomplete, 
> then I need to guess at the rest and fill it in. Often, then the test 
> case works, and there's a cycle of "I can't reproduce the problem" 
> followed by the missing bit of context that was the real cause.
> 
> Then once the problem gets fixed, the reproducible test case goes into 
> the test suite so it stays fixed.

I'm sorry, my mistake - it's in specs http://www.digitalmars.com/d/1.0/module.html

>Cycles (circular dependencies) in the import declarations are allowed as long  as not both of the modules contain static constructors or static destructors.  Violation of this rule will result in a runtime exception.

Now we have to make a manual init function called from class constructors. I understand that allowing static consructors with cyclic imports will make order of their execution undefined, but this is acceptable and actually semantically doesn't break the idea of cyclic imports. Otherwise in my opinion this behavior is inconsistent..


More information about the Digitalmars-d-announce mailing list