transparent lambda
Neal Gafter
neal at gafter.com
Wed Dec 30 13:08:45 PST 2009
On Wed, Dec 30, 2009 at 1:00 PM, Peter Levart <peter.levart at gmail.com> wrote:
> How is 'invocation of a method' defined? What would happen if method
> four was invoked multiple times from a loop:
for (int i=0; i<2; i++)
> four();
Would it this also throw unmatched transfer?
Regards, Peter
The "invocation of a method" is the execution of a Method Invocation
Expression (JLS 15.12). Technically, we should include constructor
invocations as well (JLS 15.9), since you can return from those as
well.
The second and all subsequent invocations of method two() throw the
unmatched transfer exception. Since method four() calls it twice,
method four() would always throw that exception.
Remember, this is only in a hypothetical closures specification in
which statement closures are transparent.
Cheers,
Neal
More information about the closures-dev
mailing list