Direct-Style Deep Recursive Functions in Scala 3
Kotlin's DeepRecursiveFunction turns deep recursion into a heap-allocated trampoline while keeping direct-style code, built on suspend functions. This post explains why that works, then builds a Scala 3 macro that does the same trick with no coroutines and no Project Loom, by rewriting a recursive method into a TailRec state machine at compile time.











