▲ | tombert 5 days ago | ||||||||||||||||||||||||||||||||||
I'm a pretty big functional programming nerd and I want to like tail recursion, but I honestly kind of feel like I agree with Guido on it, which is that it kind of breaks the typical stack-trace patterns. I have kind of grown to prefer Clojure's loop/recur construct, since it gives you something more or less akin to tail recursion but it doesn't pretend to be actually recursive. | |||||||||||||||||||||||||||||||||||
▲ | dreamcompiler 5 days ago | parent | next [-] | ||||||||||||||||||||||||||||||||||
Clojure does it this way because the JVM stupidly doesn't support tail call optimization. It is true that TCO messes up your stack traces. It is also true that loops mess up your stack traces, because they don't even create a stack trace. In many languages that support TCO, TCO can be turned off for debugging and enabled for production, so Guido's characterization of the issue is ridiculous. | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||
▲ | jufter 4 days ago | parent | prev [-] | ||||||||||||||||||||||||||||||||||
> ..kind of breaks the typical stack-trace patterns. The expectation that iterative recursion ought to have a call stack is the problem here and wouldn't be up for debate if people had done their due diligence and read their SICP. |