3 ms·
Scheme implementations targeting C (e.g. Chicken[1] and Gambit[2]) have literal decades of experience doing tail calls, but admittedly the resulting translation
by mananaysiempre 4y ago
Scheme implementations targeting C (e.g. Chicken[1] and Gambit[2]) have literal decades of experience doing tail calls, but admittedly the resulting translations (trampolining, Cheney on the MTA, whatever Gambit does) do not make for very natural C. The C paper[3] you mention does make note of this.
The limits of Clang’s musttail stem from the limitations of calling conventions (which, regardless of what the standard says, allow for passing more arguments than the callee expects, thus require caller cleanup). So far the solutions[4] to this seem rather awkward and definitely not backwards compatible. Are you aware of any convincing proposals in this direction?
[1] https://www.call-cc.org/ https://www.call-cc.org/
[2] https://gambitscheme.org/ https://gambitscheme.org/
[3] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2920.pdf https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2920.pdf
[4] https://www.complang.tuwien.ac.at/schani/diplarb.ps https://www.complang.tuwien.ac.at/schani/diplarb.ps