Definite Assignment rules for lambda expressions...

Neal Gafter neal at
Thu Jan 21 17:08:02 PST 2010

Correction: the old text had "lambda expression" where I quoted "closure

On Thu, Jan 21, 2010 at 5:05 PM, Neal Gafter <neal at> wrote:

> Alex Buckley pointed out to me that the CfJ 0.6a rules for definite
> assignment are a bit informal:
> The body of a closure literal may not assign to a final variable declared
> outside the closure literal.
> A closure literal does not affect the DA/DU status of any free variables it
> names.
> A free variable referenced inside a closure literal receives its initial DA
> state from the DA state of the variable at the point where the closure
> literal appears.
> So I've updated it to the slightly more formal JLS-speak
> A variable V is (un)assigned after a lambda expression iff V is
> (un)assigned before the lambda expression
> A variable V used in a lambda expression's body but declared outside the
> lambda is
>    - definitely assigned before the lambda expression's body iff V is
>    definitely assigned before the lambda expression; and
>    - not definitely unassigned before the lambda expression's body.
> The last bullet recognizes that a (blank final) variable might be assigned
> somewhere else in the program before the lambda is invoked.
> Cheers,
> Neal
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the closures-dev mailing list