Updated State of the Lambda
Jed Wesley-Smith
jed at wesleysmith.io
Wed Sep 18 17:48:00 PDT 2013
Thankfully, capturing mutable variables is prohibited. Unfortunately you
can still capture a reference to a mutable thing though, but that's life in
the fast line for you.
cheers,
jed.
On 19 September 2013 06:50, William Clark <wclark1324 at comcast.net> wrote:
> One thing I've always wanted to point out concerning capturing mutable
> local variables that always seems to go unmentioned; it doesn't just
> risk race conditions, it introduces are whole new class of error:
>
> void foo() {
> bar().run();
> }
>
> Runnable bar() {
> int n = 0;
> return () -> { n = 5; }
> }
>
> You don't have to just prevent them from leaving their capturing thread,
> you can't let them escape their capturing method as a return value or
> argument... Making them essentially useless.
>
> -William
>
> On 9/16/2013 3:36 PM, Brian Goetz wrote:
> > I've posted updated (and hopefully final) editions of "State of the
> > Lambda" and "State of the Lambda, Libraries Edition" at:
> >
> > http://cr.openjdk.java.net/~briangoetz/lambda/lambda-state-final.html
> >
> > and
> >
> >
> http://cr.openjdk.java.net/~briangoetz/lambda/lambda-libraries-final.html
> >
> >
> >
>
>
>
More information about the lambda-dev
mailing list