@SébastienRenauld You mean it wouldn't be very useful ? The question itself seems reasonable. The problem is you don't gain a lot without compile time checks
When TCO can really be used and you're competent enough to use it, then recursion doesn't really help you. In most cases, you'll lose time checking whether it applies. That's why I think TCO isn't really worth pursuing.
@DenysSéguret Your comment only applies to imperative languages, and even in those languages, sometimes the iterative solution is much more difficult to write than the recursive one
The more it goes the less sense this question makes
Think I'm just going to avoid that question. There's a trainwreck or two about to happen and mismatch in requirements (the first answer has a comment essentially going for code readability, the original question itself meanwhile forces recursion)
Just a link to the other question would be good enough. There's no hard obligation to reduce the number of questions. When I look for a problem I can read two QA
I want to lazily consume the nodes of a file tree one by one while sorting the siblings on each level.
In Python, I'd use a synchronous generator:
def traverse_dst(src_dir, dst_root, dst_step):
"""
Recursively traverses the source directory and yields a sequence of (src, dst) pairs;
...
@SébastienRenauld Strings are the first thing you encounter in any language. People try them before they even know about the borrow checker. It's natural to be confused at the beginning (not searching before asking SO is totally a different issue, though).
To be fair on myself, it wasn't crazy, but it led to complex situations and not everything added since then had the luxury of lots of careful design planning. A few heap allocations and I can get rid of a pile of complexity.