Accessing non-final local variables from a lambda expression

John Nilsson john at milsson.nu
Fri Feb 26 16:07:20 PST 2010


On Sat, Feb 27, 2010 at 12:41 AM, Neal Gafter <neal at gafter.com> wrote:

> Where it's practical, yes.  But there is a difference between
> encouraging a functional style and discouraging an imperative style.
> I admire the solution, but it isn't realistic to expect people to come
> up with it without significantly more time invested than is required
> for the simple solution.  Most programmers have a job to do and a life
> outside work.

For sure. But this is the same people we expect to learn to use lambdas.
Which will be a struggle either way.

As it will be possible to use one element arrays, or AtomicInteger or other
variants to get access to shared mutable state this isn't really a problem.
And maybe it's better if it looks somewhat cludgy.

While the version I proposed still looks like it has some syntactic
overhead, maybe this could improved with the proper attention?

BR,
John


More information about the lambda-dev mailing list