>From my understanding it's planned to allow the use of non-final local
variables in lambdas, though they may have to be marked with a keyword like
"shared" or an annotation @Shared to indicate the intent. See "Type 3
lambdas - functions capturing mutable state" in the initial translation
document draft: http://cr.openjdk.java.net/~mcimadamore/lambda_trans.pdf.

Colin

On Tue, Jun 1, 2010 at 4:27 PM, Casper Bang <[email protected]> wrote:

> > What's the actual reason for this? It's so easy to get around that it
> > doesn't seem like it should exist at all.
>
> Inner classes never really access the local variable, but rather a
> snapshot of it taken at the time the class was instantiated and passed
> along to a new stack frame. That was how it originally got
> implemented, probably for performance reasons since they were meant
> for specifying callbacks to UI libraries (Instead of native events/
> delegates/methods-pointers) and the heap is a lot more expensive to
> access than the stack?!
>
> --
> You received this message because you are subscribed to the Google Groups
> "The Java Posse" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<javaposse%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/javaposse?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to