recursive lambdas

Aleksey Shipilev aleksey.shipilev at oracle.com
Mon Sep 24 07:01:28 PDT 2012


Hi guys,

What is our current stance on recursive lambdas? I.e. should this code
considered to be correct?

    public static IntUnaryOperator fib =
       (n) -> (n < 2) ? 1 : fib.operate(n - 1) + fib.operate(n - 2);

The current EDR spec says nothing about this, except for "Remove support
for recursive lambdas" in the changelog, but both latest public b56 and
the nightly binary builds of lambda/lambda forest in OpenJDK do accept
this as the correct code.

The reason I ask is that I keep bugging IDEA guys about their lambda
support, fixing a bug here, there, and everywhere, as this helps people
to start hacking on lambdas and provide the useful feedback:
   http://youtrack.jetbrains.com/issue/IDEA-91986

I think everyone realizes the spec is in flux, but it is important to
understand what are we leaning towards.

Thanks,
Aleksey


More information about the lambda-libs-spec-observers mailing list