November 24, 2014 [Issue 13771] New: any language support capture acquire type? | ||||
---|---|---|---|---|
| ||||
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@puremagic.com Reporter: galaxylang@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 -- |
Copyright © 1999-2021 by the D Language Foundation