Expression syntax

Paul Benedict pbenedict at apache.org
Thu Nov 19 09:21:51 PST 2009


Thanks for reminding me of the previous version ;-) Okay. I think the
braces are an obvious delimiter that's helpful for reading, but I give
the benefit-of-the-doubt to Neal that he's gone through the thought
process and made the right trade-off. If Neal/Remi know of any other
possible way, maybe they could share it.

Paul

On Thu, Nov 19, 2009 at 11:17 AM, Zdenek Tronicek <tronicek at fel.cvut.cz> wrote:
> This is exactly the previous version of the closures proposal. There, the
> closure returned the value of the last expression. But there were two
> "problems" with this approach: 1) it was a concept which were not used
> anywhere else, 2) you could not return a value before the end of closure.
>
> Z.
> --
> Zdenek Tronicek
> FIT CTU in Prague
>
>
> Cituji Paul Benedict <pbenedict at apache.org>:
>
>> On Thu, Nov 19, 2009 at 10:57 AM, Zdenek Tronicek <tronicek at fel.cvut.cz>
>> wrote:
>>>
>>> Braces are not optional here because they distinguish between expression
>>> and
>>> statement lambda:
>>>
>>> #int(T) p = #(T t) t.m();  // expression lambda
>>> #int(T) p = #(T t) { return t.m(); }  // statement lambda
>>>
>>> I think this is a good choice because previous syntax (when the closure
>>> returns the value of the last expression) was confusing.
>>>
>>
>> Okay, so let's take this example. How is it substantially different than:
>> #int(T) p = #(T t) { t.m(); }  // expression lambda
>> #int(T) p = #(T t) { return t.m(); }  // statement lambda
>>
>> Couldn't the lack of "return" indicate such?
>>
>> Paul
>>
>
>
>
>


More information about the closures-dev mailing list