From: Kenneth McDonald Date: 2007-09-01T13:21:14+09:00 Subject: Re: Why stack overflow with such a small stack? 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 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. > > >