In writing the previous entry, I came across a post I made ten years ago about tail call optmization where I stated that I disliked it. But that was then, this is now, and now, I like tail call optimizations.
At the time I wrote that, I only thought tail call optimzations applied to a certain class of recursive functions, but no, it can be done in non-recursive functions as well. There may be limitations in when it can be done, but it's applicable to more than just recursive functions.
It's just a shame that such things are taught poorly and with bad examples
(if at all—the term “tail call optimization” never came up in college).
it would help if the language used for teaching supported the concepts as well
(when I was in college,
FORTRAN-77, Pascal and C—I'm not sure if
FORTRAN-77 even supports recursion;
Pascal was a pedagogical language designed by a computer scientist well known for being critical of the computer industry;
and C was just a step above assembly language).
Even some population langauges used for teaching today (cough—Python—cough)
don't support tail call optimization
because it's confusing or something.