Angry citizen stikes once again. forward references problems

Dawid Ciężarkiewicz dawid.ciezarkiewicz at gmail.com
Mon Jul 31 00:22:26 PDT 2006


Derek wrote:

> On Sun, 30 Jul 2006 21:55:59 +0200, Dawid Ciężarkiewicz wrote:
> 
>> Dawid Ciężarkiewicz wrote:
>>> In extremal situations you can even get something you can't compile in
>>> any way:
>>> http://d.puremagic.com/issues/show_bug.cgi?id=104
>> 
>> I mean:
>> http://d.puremagic.com/issues/show_bug.cgi?id=102
> 
> I don't understand this Dawid. It seems you are trying to use a nested
> class inside another class, and I'm sure you can't and shouldn't do that.
>
> I thought the purpose of nested classes was to restrict the scope of the
> nested class to its parent and thus trying to use it outside of the parent
> doesn't seem right to me.

Not right. Nested _static_ classes are just like all other classes. The only
change is just namespace. BTW. I do want use them like that and personally
I think it has many advantages.

But it's not about classes. It's about symbols used as types. This should
make more sense to all unconvinced:

$ cat test1.d
import test2;

class X {
        Y.NY t;
        enum NX {
                BLA,
                BLA1
        }
}

$ cat test2.d
import test1;

class Y {
        X.NX nx;
        enum NY {
                FOO,
                BAR
        }
}

Is impossible to compile just like bug #102.



More information about the Digitalmars-d mailing list