6 ms·
> What practical patterns are enabled by TCO in C? It's important in interpreters. Here's an example: https://blog.reverberate.org/2021/04/21/musttail-efficien
by noelwelsh 1mo ago
> What practical patterns are enabled by TCO in C?
It's important in interpreters. Here's an example: https://blog.reverberate.org/2021/04/21/musttail-efficient-interpreters.html https://blog.reverberate.org/2021/04/21/musttail-efficient-i...
- torginus 1mo agoI get that, but a lot of C interpreters use switch, for example Lua: https://www.lua.org/source/5.5/lvm.c.html#vmdispatch https://www.lua.org/source/5.5/lvm.c.html#vmdispatch
- noelwelsh 1mo agoSwitch is fine if you don't care about performance. If you do care about performance then direct threading is faster. Direct threading uses tail calls. More here: https://noelwelsh.com/posts/understanding-vm-dispatch/ https://noelwelsh.com/posts/understanding-vm-dispatch/