|
|
|
|
|
by andrew-lucker
3124 days ago
|
|
There is a whole style of programming dedicated to tail-recursion called Continuation Passing Style. It is not usually useful for programmers directly to use, because it is so complicated to read/write, but it is very useful for compilers to generate code in CPS. If you wanted to, for example, write a new experimental functional language and reuse part of the Rust compiler to sanity check and generate the executable, then tail-recursion would be really important. Similarly, if you create something like a parser generator and don't have tail recursion optimization, then you are going to run out of stack space before being able to parse stuff. So, there are lots of practical applications that depend on this feature too. |
|