let's play TDD, tackles closures in java

Llewellyn Falco isidore at setgame.com
Mon Dec 20 18:35:26 PST 2010

Wait, the idea of the pit of success is that a language/framework can
encourage you to do the right/smart thing despite yourself.

This isn't something to reject, this is something to aspire to.

moreover, it's actually the argument you've been making. "people will use
this badly, so let's not included it"

The problem is that by not including it, you also aren't really giving a
easy/workable way around it. So people then take the path of
least resistance, and end up exactly where the documentation did.


On Mon, Dec 20, 2010 at 5:47 PM, Neal Gafter <neal at gafter.com> wrote:

> Brian-
> The Oracle documentation for Java SE 7 currently teaches this technique<http://download.oracle.com/javase/7/docs/technotes/guides/security/doprivileged.html>,
> but the code there could more cleanly use the generic versions of
> doPrivileged.
> 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)?
> -Neal
> 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