Liu, Xing wrote:
> Hi,
>
>
> Is there anyone could tell me the meaning of "!" in the code below? thanks
>
> public static def run(a:Array[int](1)!, b: Rail[int]!) {
> ...
> }
>
Yes, ! is a place clause.
Specifically, this declaration should be read as saying: run requires an
argument a, which must be an Array of int of rank 1 that is local (i.e.
a.home==here), and b must be a Rail of int that is local (b.home==here).
Said differently, the type T! is the type T {self.home==this.home} in
case T does not occur in exectuable code (e.g. is the type in a field
declaration, or occurs in an implements clause) and the type
T{self.home==here} otherwise, i.e. in case T occurs in the declaration
or body of methods or constructors, or in the body of initializers.
If you declared the method as
public static def run(a:Array[int](1), b: Rail[int]) {
...
}
then a and b are not required to be local. In such a case you cannot
invoke methods on a and b that are not marked global.
Note that in X10 only methods not marked global are permitted to change
the mutable state of the object. Therefore the place type permits you to
tell the compiler that the object involved was created in the current
place, and hence it is ok to invoke methods on it that are not marked
global.
Best,
Vijay
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
X10-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/x10-users