I have an old X10 example in class which I'm trying to compile.
import x10.array.Array;
import x10.io.Console;
...
public static def main(args: Array[String](1)) {
val regionTest = 1..12;
val testArray = new Array[Int](1..12, (Point)=>0);
for ([i] in testArray) {
testArray(i) = i;
Console.OUT.println("testArray("+i+") = " + testArray(i));
}
}
Unfortunately it seems to be outdated. I could figure out by myself that you have to write public static def main(args:Rail[String])
now. The definition of val regionTest = 1..12
seems to be ok. The syntax for the array must be wrong, all following lines maybe too. I tried to fix this with this guide, but did not succeed.
My setup is working, the initial class in a new X10 Eclipse IDE project runs.
Could somebody help me port this to version 2.5.x?
There were a number of non-backward-compatible changes in X10 version 2.4, which require code changes - see the guide to "porting to X10 2.4".
Your example would be updated as follows:
This demonstrates a number of important changes:
x10.array
package tox10.regionarray
. These classes are no longer imported by default.LongRange
(1..12
) toRegion
. ARegion
object must be explicitly constructed and passed to thex10.regionarray.Array
constructor.Long
instead ofInt
. AnInt
literal must be suffixed with the character 'n
' as in '(Point)=>0n
'.Int
toLong
(to support very large data structures). Therefore the explodedPoint
iteratorfor ([i] in testArray)
now yieldsi:Long
instead ofi:Int
- which means the casti as Int
is now required when assigning to anInt
array element on line 9.