Kenneth McDonald
9/1/2007 4:21:00 AM
Unless I read otherwise, I usually assume that languages don't optimize
tail recursion. If you look at typical codebases, using tail recursion
instead of some sort of higher-level looping construct, or even a simple
basic loop, is really an academic curiosity. It doesn't normally make
code clearer or easier to write, and most people, even those who are
aware of it, don't use it. (In fact people who really know about it
often tend to avoid it because they also know of the overhead induced by
function calling.) So why bother optimizing for this case?
Ken
Jano Svitok wrote:
> On 8/31/07, Kyle Schmitt <kyleaschmitt@gmail.com> wrote:
>
>> Heh, This is one of the few languages I haven't had that happen to to
>> me on before.
>>
>> Lisp, C, C++, Perl... but I haven't caused one of those on _ruby_ before.
>>
>> Now, if you've really intended to do recursion, try making it tail recursive.
>>
>> Err... Ruby does optimize for tail recursion, right?
>>
>
> I'm not sure, after some googling it seems that 1.8 doesn't and YARV
> might partially optimize.
>
>
>