http://d.puremagic.com/issues/show_bug.cgi?id=5140



--- Comment #21 from Andrej Mitrovic <[email protected]> 2013-01-12 
10:42:15 PST ---
(In reply to comment #8)
> But they are also related, as you can implement anonymous recursion with
> __FUNCTION__:
> 
> 
> long fact(long n) {
>     if (n <= 1)
>         return 1;
>     else
>         mixin("return n * " ~ __FUNCTION__ ~ "(n - 1);");
> }

This is unreliable. If `fact` is nested inside of a mixin template you won't be
able to call the function this way. On another note this has uncovered a new
ICE in Issue 9182.

It's also very untidy to have to use mixins and string representation for
recursive calls. It's much simpler to use 'return __function(n - 1)'.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to