Alex Blewitt alex.blewitt at
Wed Jul 7 12:20:23 PDT 2010

On 7 Jul 2010, at 19:41, Neal Gafter <neal at> wrote:

> On Wed, Jul 7, 2010 at 11:37 AM, Mikael Grev <grev at> wrote:
>>> Using "return" now complicates our ability to provide nonlocal
>>> control flow in the future.
>> Only if you expect to ever use only "return" as long return. I would never
>> want to see that happen anyway, even "return return" is better, since that
>> is the new "keyword" for a new concept.
>> I think it is a bit backwards to introduce something new for a current
>> thing to keep an option to have something current mean something new in the
>> future.
> "return" currently means return from the innermost method or constructor.
> Supporting return across lambda boundaries would not change that.

If these lambdas are shorthand for creating a SAM, then "return" would work in both places to mean return from this execution context:

new Thread(new Runnable() { void run() { return; } );
new Thread( {-> return;});

This would keep the meaning of "return" sane to existing Java developers who think of lambdas as synonymous with inner classes, especially as "this" has exactly the same meaning for both under the current proposal. 

For those cases where you want to GOTO some other part of the program, I suggest we invent a new (or previously reserved keyword) for that purpose. 

Of course, some people may consider it harmful. 


More information about the lambda-dev mailing list