this should not refer to the lambda

Neal Gafter neal at gafter.com
Sun Feb 21 11:48:42 PST 2010


On Sun, Feb 21, 2010 at 11:11 AM, Alex Blewitt <alex.blewitt at gmail.com>wrote:

> Yet, were 'this' used to
> describe only the enclosing object instance (and not the lambda
> instance), you wouldn't be able to do recursive lambdas.
>

We've already shown both that the need for this is rare and that there are a
number of ways to do it without having "this" refer to the lambda itself.

I have yet to see a technical argument of what can be done if you
> disallow 'this' as a lambda reference, other than having to type in
> n+1 extra characters should you ever want to refer to the enclosing
> scope.
>

There are no "what can be done" arguments on either side: Java is
Turing-complete and will remain so.  The technical arguments for
transparency of semantics for lambdas have been made in many contexts over
the years.  A good place to start is with Steele's "Lambda the Ultimate..."
series of papers.


More information about the lambda-dev mailing list