On Thu, 17 May 2012 09:10:18 -0400, Tobias Pankrath <tob...@pankrath.net> wrote:

This does not work and I can see why.

---
auto foo(int x)
{
          if(x < 0)
              return foo(-x);
          return x;
}
----

DMD 2.059 says:
oopsc/compiler/test.d(7): Error: forward reference to foo
oopsc/compiler/test.d(14): Error: forward reference to foo

For the human reader it is easy to see that the return type of
foo should be int.

At this point, I think the human should intervene:

int foo(int x)
...

I would *hate* to have to read code like yours to try and understand it.

-Steve

Reply via email to