# considered harmful [was C++11 lambdas]
Bob Foster
bobfoster at gmail.com
Wed Mar 17 11:54:48 PDT 2010
> The JVM memory model cannot be adapted to let closures access and mutate local
> variables of their outer scope trivially, and not even after some thought, so without
> some breakthrough proposal to show how this is doable this remains off the table.
Scala manages to do it using the JVM.
Hardly breakthrough: The compiler moves variables that are or could be
modified in an inner function to an object on the heap and makes all
references to those variables indirect. People use the same trick
today when they want multiple return values; this just adds syntactic
sugar.
> [...]
Bob
More information about the lambda-dev
mailing list