capturing (or not) mutable local variables
Brian Goetz
brian.goetz at oracle.com
Sat Nov 20 13:24:14 PST 2010
Surely you realize (a) would be a huge departure from the experience
of typical java developers. Who do not read the jls.
Sent from my iPhone
On Nov 20, 2010, at 4:08 PM, Neal Gafter <neal at gafter.com> wrote:
> On Sat, Nov 20, 2010 at 1:29 AM, Brian Goetz
> <brian.goetz at oracle.com> wrote:
> If you want to capture a not-effectively-final local variable in a
> closure, then one of the following two things has to happen:
> a) The lifetime of the variable must be extended to the lifetime of
> the closure
> b) The lifetime of the closure must be shortened to the lifetime of
> the variable.
>
> The JLS doesn't talk about the lifetime of local variables because,
> like all variables and dynamically allocated objects, they simply
> cease to exist when they can no longer be referenced. There would
> be no need to change that.
>
More information about the lambda-dev
mailing list