Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The language doesn't get much of a say, stack limits are usually inherited from the OS itself. It's fixable by not using the OS-provided stack but that's a much more invasive change than a new syntax/stdlib feature.


The compiler/language absolutely gets a say in this, you can do tail call recursion without stack saturation.


Tail call elimination is an optimisation that is only possible for certain code patterns. How would you write a tail-recursive tree walk, without using a separate stack or queue data structure to store state?


Challenge accepted, I'll do it over my next long weekend.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: