On 2011-09-22 18:06, Andrei Alexandrescu wrote:
On 9/22/11 10:42 AM, pillsy wrote:
== Quote from Andrei Alexandrescu ([email protected])'s
article
On 9/22/11 1:47 AM, Max Klyga wrote:
Actually Scala doesn't need type declarations in labmda literals. Most
of the time argument types are infered.

Already does. We're looking for a briefer syntax.

What is the problem with just inferring the `return`, allowing you to
replace

(a,b) { return a + b; }

with

(a, b) { a + b; }

This seems competitive with the other syntaxes for brevity, but ISTR
there was some objection to doing things that
way.

The objection is that it introduces a number of questions:

1. How about using that syntax in regular functions?

2. What if the lambda wants to actually evaluate the expression but
return void?

I function/delegate that returns a value should be implicitly converted to a function/delegate that returns void.

--
/Jacob Carlborg

Reply via email to