r/ProgrammingLanguages • • Jan 18 '26

Why not tail recursion?

In the perennial discussions of recursion in various subreddits, people often point out that it can be dangerous if your language doesn't support tail recursion and you blow up your stack. As an FP guy, I'm used to tail recursion being the norm. So for languages that don't support it, what are the reasons? Does it introduce problems? Difficult to implement? Philosophical reasons? Interact badly with other feathers?

Why is it not more widely used in other than FP languages?

74 Upvotes

117 comments sorted by

View all comments

Show parent comment

1

u/lpil Jan 19 '26

It's like they haven't built up enough experience for it to impact them, so they pretend it doesn't exist.

This sounds like you're saying that anyone who doesn't agree with you would change their mind if they had more experience. It doesn't seem like a very strong argument to me. What stops people with a different opinion saying that you would change your mind if you had more experience?

I'm in an unusual position as I have, for a number of years, been the head of a project that involves teaching a large number of people to program in a specific programming ecosystem, and that ecosystem is split in two in a relevant way: one half has stack frame reusing tail calls, the other does not!

We get lots of information from how people are doing and what the get stuck on, and we haven't found any evidence of stack reuse causing problems. There are plenty of other problems, including unexpected overflows when stack frames are not reused, but nothing recorded from stack reuse.

This makes me think I have more experience and context than most when it comes to forming an opinion on the dangers of stack frame reuse.