return-from-lambda viewed as dangerous, good alternatives
Rémi Forax
forax at univ-mlv.fr
Thu Jan 7 10:20:51 PST 2010
Le 07/01/2010 18:50, Neal Gafter a écrit :
> 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?
>
No, I just think there is choice:
Supporting transparent lambda or not supporting it but
you can't say something like we will see in next version if we can
support it.
>
>> 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.
>
It's not totally transparent but this is as transparent as break and
continue
for loop. This is enough transparent for me.
Rémi
More information about the lambda-dev
mailing list