With X10 2.0.3, you should get a dynamic check. However, the way to fix this is to change the instance variable declaration to:
val instance = new Cell[MM!](new MM()); This will ensure that instance() returns an MM! (or MM{self.home==here}), which will allow you to call a non-global method. HTH, Igor Yan CRL Li <liyan...@cn.ibm.com> wrote on 05/18/2010 07:05:30 AM: > 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;}; > } -- Igor Peshansky (note the spelling change!) IBM T.J. Watson Research Center X10: Parallel Productivity and Performance (http://x10-lang.org/) XJ: No More Pain for XML's Gain (http://www.research.ibm.com/xj/) "I hear and I forget. I see and I remember. I do and I understand" -- Confucius ------------------------------------------------------------------------------ _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users