www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - undefined identifier

reply "Oleg" <code.viator gmail.com> writes:
Hello
I have struct in one module (vector.d)

struct vec(string S, T=double)
     if( is(T:real) && onlyASCII(S) )
{
     private T[S.length] _data;
     alias vec!(S,T) ttype;
     alias _data this;

     mixin _workaround4424;

     auto opAssign(E)( E[] b ) if( is( E : T ) )
     {
         if( b.length != S.length ) throw new Exception("bad 
length");
         foreach( i, ref m; _data ) m = b[i]; return this;
     }

     auto opAssign(E)( E[S.length] b ) if( is( E : T ) )
     { foreach( i, ref m; _data ) m = b[i]; return this; }

}

and I want to use this in other module

struct mPoint(string S,T=double)
{
     alias vec!(S,T) vect;
     private union
     {
         T[S.length*2] _raw;
         vect[2] _vects;
     }
     alias _raw this;

      property vect pos(){ return _vects[0]; }
      property void pos( vect b ){ _vects[0] = b; } //#1

      property vect vel(){ return _vects[1]; }
      property void vel( vect b ){ _vects[1] = b; } //#2
}

when compile I have error
#1 Error: undefined identifier '_data'
#2 Error: undefined identifier '_data'

why code in mPoint want use identifier _data?
unittests in vector.d use all of overriding operators well.

may it associate with aliasing of vec to array?
or it associate with overriding opAssign?
Oct 18 2012
parent "Oleg" <code.viator gmail.com> writes:
solved. its associated with access private for _data field.
if I use alias compiler must replace call "a" (for my type) to 
"a._data" if it needs...
Oct 18 2012