14th October Lambdas Hackday
Richard Warburton
richard.warburton at gmail.com
Sun Oct 21 06:56:12 PDT 2012
Lambdas Hackday
Last Sunday (14th October) the London Java Community ran another
hackday on the lambdas binary builds. Brian Goetz was there, so i
imagine that the majority of the feedback has already been discussed
somewhat. I still think its useful to post a brief summary of what
people found confusing to the public lists so people outside the EG
can see what’s going on.
1. What is the idiomatic way of expressing a generator function? So
far no one has answered this one for me, and I can't think of a good
answer myself!
2. The design of flatMap confused a lot of people. They didn’t seem
to understand the callback was a block. It was much easier to explain
the intended purpose via an example than anything else. It might
simply be the case that ‘Block’ is a bad name for result callback
handler, though I appreciate that people wish to avoid interface
proliferation.
3. People didn’t understand why Stream.fold() takes both a Combiner
and a BinaryOp, rather than just a combiner.
4. Any code that relies on getClass() is hard to transform from an
anonymous inner class into a lambda. This is because getClass() on a
lambda returns the class that it was defined within, rather than the
class of the anonymous inner class. It makes sense from the
perspective of lambdas being like blocks - but it will break things
down the line so there should probably be at least a “Beware!” type
warning.
5. The base argument of Stream.reduce() needs to be the identity value
of the combiner function if you're to get the correct answer when
running in parallel. This wasn't at all obvious to developers, and
seems like a real gotcha for people when parallel collections are
meant to be a simple method of obtaining parallelism.
I’ll omit the bug reports (since Maurizio has already fixed them) but
link to a full feedback pastebin that people used below:
https://docs.google.com/document/d/1MranKyn-bY5uhwCEYsdKkTWnvzrUVkoZEAIehRbu-ck/edit#heading=h.vh350hbhq21c
Thanks to Brian for coming over and The JAX London Conference for
space to run the hackday in.
regards,
Richard
More information about the lambda-dev
mailing list