News for hackers. Stuff that matters.
Re:How recursion got into programming: a comedy of errors by pjmlp on Thursday July 24, 2014 @02:41AM (#8078415)
Yes it does.

That is an implementation detail. It doesn't matter if it is does at compiler or whatever runtime is targeted.

This is called lowering in compiler design speak.

Re:How recursion got into programming: a comedy of errors by lostcolony on Friday July 25, 2014 @03:58PM (#8087306)
Umm...yes, it does matter.

Closures? Can't be optimized. Polymorphic method? Can't be optimized (even if every implementation is tail recursive).

This is more than an implementation detail, it actively influences the way you write your code.

And Scala -doesn't- optimize A calls B calls A etc cases. It requires the developer to explicitly make use of scala.util.control.TailCalls. See http://www.scala-lang.org/api/2.11.2/index.html#scala.util.c... and associated white paper.

What Scala gives you is that if A calls A (calls A calls A), and is tail recursive, and A can not be overridden, it will optimize it.