• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Will Java 8 compiler ready to optimise the tail recursion calls

 
Dipta P Banerjee
Greenhorn
Posts: 11
Android Java Scala
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some of the compilers were able to optimise the tail recursion calls, for example Scala does. But till Java 7 tail recursion calls are not optimised by the Java compiler. Will Java 8 compiler is going to generate optimised byte codes for tail recursion?

I did some R&D on Scala and Java 7 compiler and posted my thoughts at Tech.pro
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, Java 8 does not do this. Java remains fundamentally an OO language, with only some functional features added to it.
 
Mike Simmons
Ranch Hand
Posts: 3028
10
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think there's anything in Java's fundamentally OO nature that would prevent it from having tail call optimization. It's just not a particularly high priority, and they've had a lot of other features they wanted to get in.
 
Richard Reese
author
Ranch Hand
Posts: 84
5
Eclipse IDE Firefox Browser Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dipta,

I don’t address this topic in the book but the following article may help: http://www.drdobbs.com/jvm/tail-call-optimization-and-java/240167044


 
Dipta P Banerjee
Greenhorn
Posts: 11
Android Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Richard Reese wrote:Dipta,

I don’t address this topic in the book but the following article may help: http://www.drdobbs.com/jvm/tail-call-optimization-and-java/240167044



Thanks Richard, specially pointing to the article.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic