Forward reference wheel.

Chris Sauls ibisbasenji at gmail.com
Sat Mar 11 04:00:17 PST 2006


Dawid Ciężarkiewicz wrote:
> It's probably well known issue:
> 
> $ cat test.d
> import test2;
>  
> class X {
>         Y.NY t;
>         static class NX {
>         }
> }
>  
>  
> $ cat test2.d
> import test;
>  
> class Y {
>         X.NX nx;
>         static class NY {
>         }
> }
>  
>  
> $ dmd -c test2.d test.d
> test2.d(3): class test2.Y is forward referenced when looking for 'NY'
> test2.d(3): class test2.Y is forward referenced when looking for 'NY'
> (...)
>  
> dpc at empire:~/stg/tmp$ dmd -c test.d test2.d
> test.d(3): class test.X is forward referenced when looking for 'NX'
> test.d(3): class test.X is forward referenced when looking for 'NX'
> (...)
> 
> 
> What I'd like to ask is: "How should I consider this?" to know what should
> do with this problem in my code.
> A) it's not a bug - it's just little limitation - things shall stay like
> this;
> B) it an issue, but it will not be fixed sooner than > 1.0;
> C) stay tuned, it surly be ready sooner than 1.0;
> D) it's fixed already - wait for 0.150 or maybe just little longer.
> E) you n00b! you can resolve this already without code modification by
> doing: (...);
> 
> Thanks,
> Dawid
> 
> 
> 

E) I think.  I believe you should be able to avoid this by changing `import test;` to 
`private import test;` and likewise for the `import test2;` in the other module.  The 
private mode import will stop some cycles.

-- Christopher Nicholson-Sauls



More information about the Digitalmars-d-bugs mailing list