Expression syntax

Zdenek Tronicek tronicek at fel.cvut.cz
Thu Nov 19 09:17:40 PST 2009


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