@Dannie well yes but actually no. The problem is still that when the body of a lambda is executed, a stack frame is allocated. The point of trampoling is to not do that
essentially you have some run
method of Trampoline which is iterative or tail recursive and by suspending all of your functions in that Trampoline type (rather than executing them in place), you can make the execution of the original function only take one stack frame
it's all very roundabout
and actaully something I didnt really think about is that you can manually write run
to be iterative, not relying on there being tail call optimization. That means it's possible in java as well @tterrag
yeah here we go
interface Trampoline<T> {
default T run() {