News for hackers. Stuff that matters.
Re:WebAssembly Tail Calls by ufo on Thursday April 06, 2023 @11:11PM (#35477576)
If a function calls itself using tail-recursion, a compiler can turn that into a loop without too much trouble. However, if it's tail-calling a different function then that becomes more difficult; it would have to merge the two functions into a single WASM function. And if the tail-call is indirect (through a function pointer) then it is impossible to turn into a loop.

> It feels like tail calls are too high level of a concept to be in an "assembly" language.

WASM is a bit higher level than typical assembly languages. It doesn't have unrestricted "goto", so there's no way to implement tail calls optimization the "hard way".

There are no comments on this comment yet.