Checked exceptions within Block<T>

Neal Gafter neal at
Wed Jan 16 13:32:21 PST 2013

On Wed, Jan 16, 2013 at 10:24 AM, Remi Forax <forax at> wrote:

> The current lambda spec doesn't allow to capture variable, only value can
> be captured.

The current spec allows you to use the name of a variable inside the lambda
after the scope in which the variable was declared has exited.  The meaning
is that it gives the value last (and only, in the current spec) assigned to
that variable.  You can't "capture a value" because a value does not have a
name.  Allowing capture of mutable variables simply removes the
parenthetical restriction in my description.

There is no reason for such lambdas to be "biased to the current thread".
> There is a good reason, avoid to have to declare volatile local variable.
> And if you can transfer ownership  I don't see the problem.

For the same reason, you should be able to declare instances of classes
"biased to the current thread" so that you can "avoid to have to declare
volatile fields".  Unless you're considering that for classes, I don't see
why you'd consider that for lambdas.

More information about the lambda-dev mailing list