Re:Parallel Programming: I Told You So
by JulianMorrison on Wednesday September 16, 2009 @11:11AM
(#825942)
Pretty similar to Java anonymous inner instances of Runnable and Callable, then.
[ Parent
| on HN ]
Except those can't read nor modify variables in their enclosing scope. Anonymous inner instances are more akin to C's nested functions, which GCC has had for a long time.
Correct me if I'm wrong though (which would only make me very happy); been years since I did Java.
Re:Parallel Programming: I Told You So
by JulianMorrison on Thursday September 17, 2009 @05:51AM
(#827730)
They can read and modify object fields in their outer class's instance. But it's true they can't modify stack variables. This makes contextual sense - C blocks are being stack allocated and have to be explicitly copied to the heap. Java inner instances get copied immediately, because everything lives on the heap in Java.