Jon Harrop wrote:
James Kanze wrote:
>On Mar 6, 12:54 am, Jon Harrop <use...@jdh30.p lus.comwrote:
>>James Kanze wrote:
I'm sorry, but it's frustrating. Somewhat upthread, someone
said "recursion" , doubtlessly ironically, since I do presume
that everyone would realize that explicitly recursing
1000000 times was a bad idea.
If you think there's something wrong with recursion then
there's something wrong with your chosen language(s) and
implementatio n(s)...
If you think you can recurse a 1000000 times in C or in C++,
you've got another think coming. It just won't work, at least
with the implementations I've got access to.
Exactly. That is a shortcoming of those languages and does not reflect upon
recursion.
It's not a short-coming of the languages, it's a QoI issue. Functional
languages translate such deep recursion into loops, because they have
to. Procedural languages provide looping constructs directly, so there
is not a compelling reason to perform such an optimization. If
recursion ever becomes a hyper-fashionable alternative to looping,
subsequent procedural language implementations likely will offer
guarantees about what sorts of recursion will be translated to loops.
In today's environment, though, as Peter Koch said, there is rarely (if
ever) a need for such deep recursion, anyway.