Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Will Java 8 compiler ready to optimise the tail recursion calls

 
Greenhorn
Posts: 11
Android Scala Java
  • 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
 
Rancher
Posts: 43016
76
  • 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.
 
Rancher
Posts: 3625
40
  • 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.
 
author
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 Scala Java
  • 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.
 
The longest recorded flight time of a chicken is 13 seconds. But that was done without this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic