Project Lambda: Java Language Specification draft
Neal Gafter
neal at gafter.com
Mon Jan 25 10:38:24 PST 2010
On Mon, Jan 25, 2010 at 8:05 AM, Zdenek Tronicek <tronicek at fit.cvut.cz> wrote:
> Right. It is not specified well. However, the correction is not difficult:
>
> SAM sam = #()(3);
>
> is desugared to
>
> SAM sam = new SAM() {
> public int f() { return 3; }
> }
That only works when the expression being converted is a lambda. What
if it is some other expression of function type?
It also doesn't play well with these parts of the specification:
On Fri, Jan 22, 2010 at 2:55 PM, Alex Buckley <Alex.Buckley at sun.com> wrote:
> It is a goal of this document
> to allow the implementer freedom as to how and when lambda expressions
> are evaluated.
and
> Therefore, it is convenient for the body of a lambda expression to
> have access to members of the SAM type. To achieve this, I am thinking
> that 'this' in the body of the lambda expression may be cast to the
> SAM type:
More information about the lambda-dev
mailing list