Cyclic Dependencies

Zarathustra adam.chrapkowski at gmail.com
Mon Dec 8 23:37:30 PST 2008


Ellery Newcomer Wrote:

> Hello all,
> 
> I began learning D a few months ago, and now I have a question about 
> cyclic dependencies (and some random whining).
> 
> I come from a java background and have had no serious exposure to C++. 
> In java, cyclic dependencies are legit to the best of my knowledge. I 
> don't know about C++, thus I don't know about D.
> 
> When I first started learning D I decided that a good way to learn it 
> would be by porting a popular java api (mind, I didn't say intelligent), 
> which came complete with a few cyclic dependencies. At the moment, I'm 
> using GDC, and it refuses to swallow cyclic dependencies. The compiler 
> doesn't complain, but it throws a runtime exception. I can break the 
> dependency loops and GDC will work just fine, but what I'm wondering is 
> whether it is standard that the dependency hierarchy be acyclic, or is 
> this some quirk of GDC, or is it more likely that there is something 
> weird going on in my java-to-D translation.
> 
> Also, I would be trying to compile with DMD, but I have evidently 
> managed to crash the compiler, and I don't know if it's DMD's fault or 
> mine. It reports an Internal Error in e2ir.c at line 3904. (not being a 
> C++ guru, the line "assert(n2->Enumbytes);" doesn't mean much to me)
> That was with DMD 1.037, Tango 0.997, and using dsss to build.
> 
> On an unrelated note, is this code supposed to be incorrect?
> 
> wchar[] w = (true)? "true":"false";
> 
> --> Error: cannot implicitly convert expression ("true") of type char[] 
> to wchar[]
> 
> or should it be reported as a bug?

just use:
wchar[] w = (true)? "true"w:"false"w;


More information about the Digitalmars-d-learn mailing list