Re:Nash – A tracing JIT compiler for Scheme [pdf]
by tonyg on Saturday March 04, 2017 @03:50PM
(#13792867)
In principle, maybe; in practice, currently, no: Scheme requires proper tail calls, and Javascript engines as a rule do not provide them. Yet.
[ Parent
| on HN ]
Re:Nash – A tracing JIT compiler for Scheme [pdf]
by microcolonel on Saturday March 04, 2017 @06:18PM
(#13793457)
http://kangax.github.io/compat-table/es6/ < The most popular version of the most popular javascript engine supports tail call optimization.
That said, it would still probably be worth doing the optimization in the transpiler, to avoid having the JS compiler have to work out if your program runs into any JS pitfalls.
Re:Nash – A tracing JIT compiler for Scheme [pdf]
by e12e on Saturday March 04, 2017 @06:15PM
(#13793446)
Wouldn't any scheme runtime/compiler need to handle that, though? In other words, wouldn't a transform to a loop (on the js side) be one possible approach?
Re:Nash – A tracing JIT compiler for Scheme [pdf]
by ufo on Saturday March 04, 2017 @07:06PM
(#13793726)
Only if you know at compilation time what function(s) you will be calling in a tail recursive manner. If the function you call comes from a parameter or variable (for example, in continuation passing style code) then there is no straightforward way to compile it into a loop.