Open tanaka-de-silva opened 7 years ago
after we upgrade 4.04 we have more fine control over the inlining info and tail call annotation. And in 4.04 we will optimize local exception into a jump. so we will wait until 4.04 upgrade finishes. Note we have baked in conditional compilation in case you need a workaround http://bloomberg.github.io/bucklescript/Manual.html#_conditional_compilation_support_static_if
Note that newer versions of node support tail call optimization in accordance with the ES6 spec. Here is a demonstration.
Hi! Any updates on this? I have a parser generated with Menhir and it gives me a stack overflow whenever I try to run it on a real-world amount of Lua code. Node 8 removed the tail calls flag, so I'm left with no solution.
I see occasional mentions of adding trampolines but I think it's still a long-term plan. My app has a small enough JS surface area that I was able to switch to js_of_ocaml to get trampolining. I kept the Bucklescript compile path for development, though, and I look forward to being able to use it for production eventually 😉
Watching. I would love to see trampolines added.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I’ll give it one more ping. Five years later we are sick of needing native dependencies in an otherwise fully NPM environment, but without trampolines we can’t use ReScript. Our only option is to rewrite the section of code that generates mutually recursive functions, and then switch.
Introduce an annotation to rewrite mutually recursive functions to use a trampoline. This will enable the user to avoid exceeding the stack size at the expense of more overhead until ES6 proper tail calls are widely implemented (it is only available in Safari 10 & WebKit at the moment).