4 ms·
>It could have done the other thing and limited inputs to recursive code, which would have required more careful code analysis (static and dynamic) to figure ou
by coldtea 11y ago
>It could have done the other thing and limited inputs to recursive code, which would have required more careful code analysis (static and dynamic) to figure out what the limits should be. It's an understandable decision, but don't forget it's a trade-off, and one that could have gone another way.
I don't see the trade-off.
On one hand (if you allow recursion) you need "more careful code analysis".
On the other hand, if you don't allow it, you don't lose anything. You can write the algorithm in another way, and it would be just as fast and easier to reason about.
So what's the tradeoff? It's not like recursion brings some benefit that you lose if you disallow it.
- cbd1984 11y ago> On the other hand, if you don't allow it, you don't lose anything. You can write the algorithm in another way, and it would be just as fast and easier to reason about. This is where we differ, then: Some algorithms are more natural to write recursively. Sorting is a big example.