Edit: this is wrong.
For posterity my original comment was:
“From what I understand, tail calls can always (?) be lowered to while loops[1], which are expressible in WASM.
1. https://en.wikipedia.org/wiki/Tail_call#Relation_to_the_whil...
For posterity my original comment was:
“From what I understand, tail calls can always (?) be lowered to while loops[1], which are expressible in WASM.
1. https://en.wikipedia.org/wiki/Tail_call#Relation_to_the_whil...
If you have an A -> B, or A -> [indirect] call, that is not the case.
g(): a = 1+1; b = 2+a; print(b); return f()
into code that does not allocate stack space and just reuses the frame allocated for g()?
It's an ugly piece of code, but because of parsers, there is a huge amount of know how on it.
For example, what if those functions are in different modules or libraries? Tail calls are still supposed to work.