Hi all, Thanks for the answer.
I just tested the following (only 0 is changed to 0.0) and it is compiled. 1. It seems that the compiler fails to do the implicit cast from Point->Int to Point->Double in the previous code snippet. 2. The compiler does not complain about the rank of the point here that as you said it should. val d = (0..10)->Place.FIRST_PLACE; val a = Array.make[Double](d, (p:Point) => { return 0.0; }); Best regards, Mohsen ------------------ Hi, Mohsen, Granted, the error message could be better. Your problem is caused by the fact that your closure type is wrong. The signature of the Array.make you're trying to invoke is: public static def make[T](dist: Dist, init: (Point(dist.rank))=>T): Array[T](dist); Note that the rank of the Point is constrained to be the same as that of the distribution. If the typechecker cannot prove that fact, the method won't match. The fix is to change your code to: val d = (0..10)->Place.FIRST_PLACE; val a = Array.make[Double](d, (p:Point(1))=>0.0); The important changes are "Point" -> "Point(1)" and "0" -> "0.0"; the contraction of the closure is optional. Hope this helps, Igor -- Igor Peshansky (note the spelling change!) IBM T.J. Watson Research Center XJ: No More Pain for XML's Gain (http://www.research.ibm.com/xj/) X10: Parallel Productivity and Performance (http://x10.sf.net/) On Thu, Feb 4, 2010 at 8:24 PM, Mohsen Lesani <les...@ucla.edu> wrote: > Hi, > With the current release, the following simple array creation code > > val d = (0..10)->Place.FIRST_PLACE; > val a = Array.make[Double](d, (p:Point) => { > return 0; > }); > > gives the following compile time error. It seems that the make > function is not overloaded for distribution. > > Method make[T](x10.lang.Region, > (x10.lang.Point{_self8035.rank==region.rank}){}=> T) in x10.lang.Array > cannot be called with arguments > [x10.lang.Double](x10.lang.Dist{_self7467==d, d.region.rect==true, > d.region.rank==1, d.region.zeroBased==true}, (x10.lang.Point){}=> > x10.lang.Int{_self25==0}); > Call invalid; actual parameter of type |x10.lang.Dist{_self7467==d, > d.region.rect==true, d.region.rank==1, d.region.zeroBased==true}| > cannot be assigned to formal parameter type |x10.lang.Region| > > Please comment. > > Mohsen > ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users