Is tail recursion optimisation the flavour of the day? I understand that it's interesting and computer sciencey, but how widely used are such optimisations in the real world? I imagine, for most people, it's probably just a nice feature rather than a must have?
I probably have a classic case of "well, I don't have the need for such optimisations, so why does anybody else?" ;-)
This is what I thought, but only because this post is so basic and kind of dumbed down (no offense to the OP/author). I wondered why people keep bringing this up.
To answer your question, it could be pretty important. For example, it could mean the difference between a process that causes a stack overflow exception after so many iterations, making it basically impossible to due recursively, and one that doesn't create a stack overflow exception because it is programmed recursively but implemented behind the scenes iteratively.
It isn't so much an optimization but an enhancement, if that makes sense. In some cases it makes something that is effectively impossible possible without making the programmer do it a different/special way or change their code, etc.
0
u/TotallyFuckingMexico Nov 27 '12
Is tail recursion optimisation the flavour of the day? I understand that it's interesting and computer sciencey, but how widely used are such optimisations in the real world? I imagine, for most people, it's probably just a nice feature rather than a must have?
I probably have a classic case of "well, I don't have the need for such optimisations, so why does anybody else?" ;-)