[Issue 8452] if lambda function can be template?

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Aug 8 18:30:03 PDT 2014


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

--- Comment #4 from galaxylang <galaxylang at gmail.com> ---
i want to say,template delegate/function  and type deduce can be mix,
for example

alias f2=(x,y)=x+y;
alias f1=f2(1);//here,use alias syntax will be impossible or need more
handwrite

but if we use auto keyword

int var=1;
auto f2=(x,y)=x+y;
auto f1=f2(var)

the f1 will be  template function,if "var"is local in inner scope,f1 is a   
delegate 
int function(int)();
int delegate(int)();

this will enable template deduce look more clear,and more powerful,even more,
if we really need template for calculate many many types?

use auto instead alias keyword will change D language more powerful

--


More information about the Digitalmars-d-bugs mailing list