3 ms·
Technically you don’t need loops, that’s true. But from a pragmatic standpoint, it’s just too easy for someone to turn a tail-recursive function into non-tail
by tzahola 8y ago
Technically you don’t need loops, that’s true.
But from a pragmatic standpoint, it’s just too easy for someone to turn a tail-recursive function into non-tail recursive, causing a stack overflow eventually.
So when working in a large team, with run-of-the-mill programmers, I’d stick with loops.
- chriswarbo 8y agoWould an annotation help, e.g. a `tailcall` keyword, which will trigger an error for non-tailcalls?
- tasuki 8y agoFwiw, Scala does exactly that with its `@tailrec` annotation.