[Issue 13771] New: any language support capture acquire type?
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Nov 24 07:17:05 PST 2014
https://issues.dlang.org/show_bug.cgi?id=13771
Issue ID: 13771
Summary: any language support capture acquire type?
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: galaxylang at gmail.com
auto add(T)(T a,T b)
{
return to!RetureType(a+b);
}
void fun(T)(T x)
{
}
fun!double(add(1,2));
fun!int(add(1,2));
just add a implicit RetureType,not need visible,background syntax tree like
this
auto add(RetureType,T)(T a,T b)
but we can see ,the type reduce logical changed from down-up to up-down
template SelectFrom(T)
{
alias SelectFrom=T;
}
auto add(T=SelectFrom!(ReturnType))(T a,T b)
these will change the language' template more magic when mix use with
opCast,opDispacth...act
--
More information about the Digitalmars-d-bugs
mailing list