Expression syntax
Paul Benedict
pbenedict at apache.org
Thu Nov 19 09:02:11 PST 2009
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