▲ | hinkley 5 days ago | |||||||
I’m good at spatial thinking, so on paper I should have zero issues with recursive code. But I also mentor and troubleshoot a lot and deep recursive code blows everyone’s mind. Even, it turns out, often the people who wrote it. Though they will swear otherwise. Self recursive code takes on a fractal nature - at any call stack you cannot determine the call depth. You are in a twisty little maze. When you layer calls horizontally, different tasks at different depths, it’s dead obvious where you are in the calculation. If all you can manage though is iteration, you still have the local variables to tell you where you are. | ||||||||
▲ | eru 5 days ago | parent | next [-] | |||||||
I spend half my career with Haskell, OCaml, Erlang and we never had these problems with recursive code. (Or rather, we never had these problems and blamed it on recursion. We had to deal with plenty of bad code, of course.) In contrast, I remember plenty of problems stemming from mutation (and lack of static typing etc). | ||||||||
| ||||||||
▲ | busterarm 5 days ago | parent | prev [-] | |||||||
I certainly understand your perspective and I've seen what you talk about it but I've just never run into problems with it personally... and yeah, as others said, mutation is often the source of more problems. Generally though I don't like hard "don't use X" rules. There's a time and place for everything -- it all comes down to what you're prioritizing at a given time. I try not to be dogmatic about anything. | ||||||||
|