let's play TDD, tackles closures in java

Neal Gafter neal at gafter.com
Mon Dec 20 17:47:05 PST 2010


The Oracle documentation for Java SE 7 currently teaches this
but the code there could more cleanly use the generic versions of

Perhaps it would be helpful if you would describe the preferred way to write
sequential code where part of a local computation is performed inside a
lambda (but where the part performed inside the lambda is more complex than
just returning a single value).  Do you believe that such computations
should be done using variables hand-hoisted to fields of some class (perhaps
one built just for that purpose)?


On Mon, Dec 20, 2010 at 4:26 PM, Brian Goetz <brian.goetz at oracle.com> wrote:

> > You might argue that people "shouldn't" write the above code.
> > I am trying to be a messenger, to let you know that people are "going" to
> be
> > writing this code,
> > Books will be written teaching this code.
> > Blogs will be show off the "correct" way to access local variables.
> >
> > this is the path you are heading on....
> Your argument amounts to: the world is full of idiots who will do stupid
> things, so you might as well get a lobotomy and join them.
> I reject this argument.
> Let's move on.

More information about the lambda-dev mailing list