JUGM-20250217: Catching Recursion by the Tail: The State of Tail Recursion Optimization in Modern JVMs
Can tail-recursive calls in Java be replaced with loops? Uncover the mystery behind this optimization, explore supporting tools, and dive into JVM-friendly languages like Scala and Kotlin – and why it all matters.
Beschreibung
Transforming tail recursion into a loop is a popular optimization in functional programming languages; however, in the Java world, this transformation is shrouded in mystery.
We will explore whether replacing tail-recursive calls with loops is possible in Java, why one might want to do so, and which virtual machines support this (and whether it’s legal). We will also examine third-party tools that can help you optimize your programs in a functional style. And we will look at JVM-friendly languages that have more pronounced functional tendencies (such as Scala, Kotlin, etc.).