[Issue 9306] __function alias
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Feb 25 19:19:28 PST 2017
https://issues.dlang.org/show_bug.cgi?id=9306
b2.temp at gmx.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |b2.temp at gmx.com
--- Comment #1 from b2.temp at gmx.com ---
It's easy to do at the library level:
auto recursion(string Fun = __FUNCTION__ , A...)(auto ref A a)
{
import std.typecons: tuple;
mixin("return " ~ Fun ~ "(" ~ a.stringof ~ "[0..$]);");
}
used like this:
long factorial(long a)
{
if (a <= 1)
return a;
else
return a * recursion (a-1);
}
void main()
{
auto a = factorial(20);
}
So maybe this one could be closed as WONTFIX ?
--
More information about the Digitalmars-d-bugs
mailing list