3 ms·
>Unfortunately for Scala programmers, the JVM doesn't perform this optimisation. Kotlin performs tailrec optimisation and is compiled to jvm.
by sorokod 9y ago
>Unfortunately for Scala programmers, the JVM doesn't perform this optimisation.
Kotlin performs tailrec optimisation and is compiled to jvm.
- iainmerrick 9y agoA little further down it says “Luckily, even without JVM support, the Scala compiler can perform tail-call optimisation in some cases.”
- jonalmeida 9y agoI'd say the full quote to be, "Luckily, even without JVM support, the Scala compiler can perform tail-call optimisation in some cases. The compiler looks for certain types of tail calls and translates them automatically into loops." This wouldn't be actual TCO in that case.
- iainmerrick 9y agoIf it’s done right, there would be no observable difference.
- oweiler 9y agoIn Kotlin the compiler is doing the TCO similar to Scala.