5 ms·
It gives you arbitrarily complex control flow even in presence of modularity. A tail call is a state transition. Without them, you'd have to resort to a big loo
by jhgb 10mo ago
It gives you arbitrarily complex control flow even in presence of modularity. A tail call is a state transition. Without them, you'd have to resort to a big loop (which breaks modularity), or some sort of trampoline (which works but it's a bit clumsy).
- artemonster 10mo agothis whole thing is equivalent to a goto at the beginning of a function.
- jhgb 10mo agoYes, except without all the known disadvantages of goto. That's the whole point.
- artemonster 9mo agohuh? what is the disadvantage? i am very tired of people parroting some non-arguments. goto is awesome. solves TCO, multiloop breaks, switches and whole lot more
- dragonwriter 10mo agoThis is true in the same sense that function calls are equivalent to gotos at the beginning and end of the function.