Possible @property compromise

TommiT tommitissari at hotmail.com
Fri Feb 1 22:03:59 PST 2013


On Saturday, 2 February 2013 at 03:50:49 UTC, Zach the Mystic 
wrote:
> assert(A.B.C.myMemberFunction(a, a.b, a.b.c) == 3);

That wouldn't compile, so you must mean:

assert(a.b.c.myMemberFunction(a, a.b, a.b.c) == 3);

What do you suppose would happen if I wrote the following?

struct A
{
   int _a = 1;
   B b;
   struct B
   {
     int _b = 1;
     C c;
     struct C
     {
       int _c = 1;
       int myMemberFunction() { return _a + _b + _c; }
     }
     static int otherFunction()
     {
       C cc;
       return cc.myMemberFunction();
     }
   }
}

void main()
{
   int i = A.B.otherFunction();
}


More information about the Digitalmars-d mailing list