|
|
|
|
|
by SemanticStrengh
1512 days ago
|
|
Coroutines are much less coloured than async await programming though since functions returns resolved types directly instead of futures. But yes there is the notion of coroutine scope but I don't see how to supress it without making it less expressive. Very few people know it but Oracle is developping an alternative to Loom, in parallel. https://github.com/oracle/graal/pull/4114 BTW i expect Kotlin coroutines to leverage loom eventually. As for the tailrecursive keyword, it is not a constraint but a feature since it guarantee at the type level that this function cannot stack overflow.
Few people know there is an alternative to tailrecursive, that can make any function stackoverflow safe by leveraging the heap via continuations
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-deep-re... As for Java, there is universal support for tail recursion at the bytecode level
https://github.com/Sipkab/jvm-tail-recursion |
|
I've been using an IntelliJ extension that can do magic by rewriting recursive functions to stateful stack-based code for performance, but it spits out very ugly code:
https://github.com/andreisilviudragnea/remove-recursion-insp...
It was this guy's whole Bachelor thesis I guess:https://github.com/andreisilviudragnea/remove-recursion-insp...