Correct. There is a typedef that allows for a shorter definition: val A:Array[Int]{rank == 2}; val A:Array[Int](2);
Also, if you like to specify types, but you want the compiler to add extra constraints to your type, you can write: val A *<:* Array[Int] = new Array[Int]((0..2)*(0..3), 0); which means that the inferred type for "A" must be a subtype of Array[Int] On Wed, Dec 8, 2010 at 12:01 PM, Kirak Hong <hok...@gatech.edu> wrote: > Ah, I just found that I should use constrained type as following : > > val A:Array[Int]{rank == 2} = new Array[Int]((0..2)*(0..3), 0); > > > > I guess the constrained type allows X10 to generate proper method to access > the array, with rank information. Is this true? > > Thanks, > Kirak > > On Wed, Dec 8, 2010 at 11:55 AM, Kirak Hong <hok...@gatech.edu> wrote: > > > Hi, > > > > I got an error when I run the following code : > > > > val A:Array[Int] = new Array[Int]((0..2)*(0..3), 0); > >> A(1,1) = A(1,1)+1; > >> > >> error : > >> Method or static constructor not found for given call. > >> Call: A(x10.lang.Int{self==1}, x10.lang.Int{self==1}) > >> > > > > However, following code form programming manual seems work well. > > > > val A = new Array[Int]((0..2)*(0..3), 0); > >> A(1,1) = A(1,1)+1; > >> > > > > The only difference is that I specified type for A4 when define, and I > need > > to do that since I want to put the A as member variable of a class. > > Can anybody please help me? > > > > Thanks, > > Kirak > > > > ------------------------------------------------------------------------------ > This SF Dev2Dev email is sponsored by: > > WikiLeaks The End of the Free Internet > http://p.sf.net/sfu/therealnews-com > _______________________________________________ > X10-users mailing list > X10-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/x10-users > ------------------------------------------------------------------------------ This SF Dev2Dev email is sponsored by: WikiLeaks The End of the Free Internet http://p.sf.net/sfu/therealnews-com _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users