Discrete semantics of lambda expressions
Timon Gehr via Digitalmars-d
digitalmars-d at puremagic.com
Mon May 2 13:50:45 PDT 2016
On 02.05.2016 22:20, Adam D. Ruppe wrote:
> On Monday, 2 May 2016 at 20:11:53 UTC, Timon Gehr wrote:
>> I don't think { ... } as shorthand for (){ ... } is necessary or
>> particularly useful in the first place.
>
> Indeed. I don't think =>x as a shorthand for {return x;} is really worth
> it either... D has a ridiculous number of variations on function syntax.
> ...
function int delegate()delegate(int)(int y){ return (x)const=>{ return
x+y;}; }; // :o)
(=>x is not valid.)
> But I don't expect any of them to be removed either.
Most of them don't hurt much (unlike { ... }). It's quite annoying that
function definition syntax and delegate literal syntax are inconsistent
though. E.g. lambda syntax should be usable for named functions (int
x()=>3;).
More information about the Digitalmars-d
mailing list