Look at x10.lang.PlaceLocalHandle. On 12/6/2010 4:48 AM, Andreas Zwinkau wrote: > I just wrote some code, which uses a common master-slave pattern. > Some computation is pushed to all slaves (in other places), which use > different data to work on. My idea was to store this data in a wrapper > in a static field. The wrapper AlwaysLocal (see below) gives out the > local data to every computation. > > Isn't this a common pattern? Is there already something in X10 (syntax > or stdlib) to make AlwaysLocal unnecessary? > > > /* Gives every accessor a local element */ > class AlwaysLocal[T] { > val state:Array[T](1); > > def this(init:()=>T) { > state = new Array[T](Place.MAX_PLACES); > finish for (p in Place.places()) async { > state.set(init(), p.id); > } > } > > def apply():T { > return state(here.id); > } > } > > The AlwaysLocal implementation above assumes a flat places structure and > the ids to be [0..]. Thus, it is something, which has to evolve with > changes in the language. >
------------------------------------------------------------------------------ What happens now with your Lotus Notes apps - do you make another costly upgrade, or settle for being marooned without product support? Time to move off Lotus Notes and onto the cloud with Force.com, apps are easier to build, use, and manage than apps on traditional platforms. Sign up for the Lotus Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users