3 ms·
In his summary of tail call optimization, he doesn't make it clear that TCO is especially useful with mutually recursive functions. If you have eight different
by silentbicycle 16y ago
In his summary of tail call optimization, he doesn't make it clear that TCO is especially useful with mutually recursive functions. If you have eight different functions that tail call to each other (in a state machine, say), you can still do so in constant space. Doing that without TCO usually leads to inlining every state's code, and then a big switch statement or lots of GOTOs.
Tail-call optimization makes function calls more expressive. THAT's why they matter.
Any complaining that they lose debugging info strikes me as a bit weird. So do for / while loops, and leaf calls in procedures. So what? If you need logging, add logging.