Implementing recursive lambda with MethodHandle
Lawrence Kesteloot
lk at teamten.com
Mon Feb 22 11:46:26 PST 2010
On Mon, Feb 22, 2010 at 11:28 AM, Joshua Bloch <jjb at google.com> wrote:
> Yes, but it uses an (ugly) anonymous class initialization expression. The
> whole idea of this JSR is to eliminate the need for these beasts.
It concerns me that so much of the discussion on this list centers
around the use case of the programmer writing factorial functions.
Every recursive function I've ever written was too complex to fit into
a lambda. They were all part of some data structure object where I had
proper methods. If we forbid lambdas from being recursive I suspect it
would have little real-world impact, and it would be easy to explain
since they're anonymous. (Unlike the recent suggestion to make
bindings to the lambda's LHS variable be different than bindings to
other free variables.) I think our time is better spent discussing
Doug's preference for a parallel-safe construct and whether that's the
kind of lambda we want in this general-purpose language.
Josh, perhaps I missed it, but I don't understand why it's so
important to you that "this" refer to the function object. (Other than
for a recursive call.) Can you provide a few use cases?
Lawrence
More information about the lambda-dev
mailing list