Why doesn't scalac (the Scala compiler) optimize tail recursion?
Code and compiler invocations that demonstrates this:
> cat foo.scala 
class Foo {
 def ifak(n: Int, acc: Int):Int = {  
   if (n == 1) acc  
   else ifak(n-1, n*acc)  
 }
}
> scalac foo.scala
> jd-gui Foo.class
import scala.ScalaObject;
public class Foo
  implements ScalaObject
{
  public int ifak(int n, int acc)
  {
    return ((n == 1) ? acc : 
      ifak(n - 1, n * acc));
  }
}
 
     
     
     
    