3 ms·
If you're going to make a generalization, I think recursion is fine, efficient, and rarely dangerous. There may be use cases where it's insecure or has perform
by munificent 3y ago
If you're going to make a generalization, I think recursion is fine, efficient, and rarely dangerous.
There may be use cases where it's insecure or has performance concerns, but those are the exception. Most of the time, it's fine.
We don't generally tell programmers that loops are naive, often dangerous, and risk locking up the program. They certainly can, but most just... don't.
Just like loops, recursion can make code much simpler to write, read, and maintain. Every modern language under the sun supports it for very good reasons. Use it.
- Joel_Mckay 3y agoFor many reasons, people often add nesting limits in recursive structures to at least constrain how bad they behave when something eventually does go wrong. Parsers are far from immune to these issues. I think we will have to "agree to disagree" here... =)