Dear,

When I compile the following code, I meet the compile error :
Place type error: Method should be global. (Called within a global method.)
Method: value
1 error.

I can not make method value as global as it need to reference var v;

Can any one show me where is wrong ? Thanks

Code :
Hello.x10

class Hello {

 public static def main(args:Rail[String]):void {
     val instance = new Cell[MM](new MM());
     finish {
         for (p in Dist.makeUnique()) {
             async (p) {
                 instance().offer(1);
             }
         }
     }
       val x = instance().value();.
//     Console.OUT.println("value: " + x);;
  }
}

MM.x10
class MM {
  var v:Int;
  public def this(){v=0;}
  public def offer(i:Int) {v=v+i;}
  public def value():Int {return v;};
}

Thanks

Li Yan (李严)

System Group, IBM China Research Lab
Tel: 8610-58748060
Tieline: 11905-8060
Add: Building 19 Zhongguancun Software Park, 8 Dongbeiwang WestRoad,
Haidian District, Beijing, 100094, P.R.China
E-mail: liyan...@cn.ibm.com
------------------------------------------------------------------------------

_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to