DEV Community

Discussion on: Do you even recurse?... And if you do, do you do it safely?

Collapse
 
bgadrian profile image
Adrian B.G.

Actually TCO is not implemented in the majority of the mainstream languages, so I avoid recursion by all means. Hopefully things will change now that Java and C# are adding FP goodies.

You can do hacks like these in dynamic languages but you'll not convince a lot of ppl to adopt them.

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

I continue to use recursion where it's difficult to implement an algorithm without (lots of tree structures come to mind), or where unrolling the recursion makes it harder to understand. So long as it isn't too deep it's fine.

Collapse
 
bgadrian profile image
Adrian B.G.

Ah yes, if the amount of data is pretty deterministic and small and the iterative version is too cumberstone I do the same.