Am 27.12.2011 20:51, schrieb Vladimir Panteleev:
On Tuesday, 27 December 2011 at 19:46:31 UTC, Joshua Reusch wrote:
Am 27.12.2011 20:35, Vladimir Panteleev wrote:
Halting problem?

Makes an not-stopping pure function really sense?

No, but you don't know if the user is expecting the function to take a
long time to run, or it's stuck due to a bug.


If the function gets evaluated at compile-time, also the loop/recursion conditions are known.

If you evaluate a function creating an infinite loop at compile-time,
you get for sure in this state. Then, the compiler could stop the
evaluation after some time and print an error/warning or creates
runtime code.

The problem is with "after some time". It's not possible to know when
the compiler should stop. For all it knows, the user is doing some
compile-time raytracing.

ok, "after some time" is really not the right approach. But as I wrote above, the compiler knows the conditions for loops. The function also is pure, so it should have the same behaviour with the same arguments. With a function calling stack it should be possible to detect infinite recursive calls.

Reply via email to