https://issues.dlang.org/show_bug.cgi?id=8452

--- Comment #3 from Martin Nowak <[email protected]> ---
(In reply to galaxylang from comment #2)
> as you can see
> 
> auto  lam3 =(x,y)=>x+y;
> lam3(1,2)
> 
> lam3 like a named variable,but it really don't save anything,just some info
> can be deduced from complier,so it's just a alias 

    file.d(1): Error: variable file.lam3 type void is inferred from initializer
(x, y) => x + y, and variables cannot be of type void

The error is confusing because templates internally have the type void.

We don't plan to support auto variables with polymorphic lambdas, because just
as you said, there is no actual variable/data involved.

> alias lam3 =(x,y)=>x+y;
> lam3(1,2)
There is a pull request to enable the alias syntax.
https://github.com/D-Programming-Language/dmd/pull/3638

> so,i want to say,it's possible ,the key word 
> alias == auto

That I don't understand.

--

Reply via email to