return-from-lambda viewed as dangerous, good alternatives
Neal Gafter
neal at gafter.com
Thu Jan 7 09:50:43 PST 2010
On Thu, Jan 7, 2010 at 2:29 AM, Rémi Forax <forax at univ-mlv.fr> wrote:
> Le 07/01/2010 10:16, John Rose a écrit :
>> For the purposes of this list (lambda-dev), I want to make a clear argument against overloading the "return" keyword to denote a lambda result value, in addition to its denotations in current Java. I also want to suggest a range of alternatives.
>>
>
> [...]
>
> I am with John about that.
>
> In my opinion, if lambda are anonymous functions, return should return
> the lambda result value
> and lambda will never be transparent lambda.
In other words, you disagree with John, and think that return should
take on the additional new meaning of returning from a lambda?
> Or if we want in the future support transparent lambda, return/break and
> continue must have
> the same meaning as in a function. In that case, lambda aren't anonymous
> function but
> anonymous expression/block of code and we have to have a new syntax for
> exiting with
> a value from a lamda block.
I don't think it matters what we call it as much as what it allows you to do.
> About the proposed syntax, I don't like 'let expression' because for
> consistency
> they should be used everywhere like in Scala or Groovy, this is not the
> case in Java.
> I prefer a keyword, any new keyword but not 'yield' which is reverved
> for coroutine. I propose 'giveup' :)
Such a new syntax isn't actually transparent. If that is the goal,
this isn't a way to accomplish it.
More information about the lambda-dev
mailing list