But, f1 and f2 are already declared as val. So, there should not be problem in accessing them.
Further, both the async statements just make it explicit what is already implicit. async { f1 = fib(n-1); } implicitly means that async activity is created here, where the root activity resides, and the enclosed statement is also executed here. The statements at (here) async { f1 = fib(n-1); } and async at (here) {fi = fib(n-1); } must also start new activity here and execute the enclosed statement in the current place, i.e., here. So, shouldn't all these three forms be correct? Jeeva P. Re: [X10-users] async at (here) and at (here) async Yoav Zibin Fri, 06 May 2011 10:22:37 -0700 This is a bug. In the upcoming 2.2 release both attempts will fail with the error: Local variable is accessed at a different place, and therefore it must be initialized and declared final. So you cannot access a local variable in a different place unless it is initialized and "val". In 2.3 there will be a new construct called "athome" that will allow you to initialize a local at a remote place by going back to the original place. On Thu, May 5, 2011 at 11:45 PM, Jeeva Paudel <je...@ualberta.ca> wrote: > Hi all, > > This is in reference to the Fibonacci example available at > http://dist.codehaus.org/x10/applications/samples/Fib.x10 > > Although async at != at async always, but shouldn't the following two > versions of async produce similar effect? > > at (here) async { f1 = fib(n-1); } must start a new activity located > here and executing S > > async at (here) {fi = fib(n-1); } must also start a new activity > here and execute S here as well. > > Aren't both the same and should compile correctly when the program > compiles correctly with async { f1 = fib(n-1)} ? However, the compiler > reports this error : "f1" may not have been initialized > > > Thanks, > Jeeva P. ------------------------------------------------------------------------------ WhatsUp Gold - Download Free Network Management Software The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution. http://p.sf.net/sfu/whatsupgold-sd _______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users