We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It would be cool if there was a CLI flag that compiled Moonscript with an avoidance of tail calls. The use case is debugging, of course.
This is probably hard to accomplish, but I figured I would make the suggestion anyway.
The text was updated successfully, but these errors were encountered:
How do you think it should modify the code?
Sorry, something went wrong.
Would something like this work?
return f!
To:
tmp = f() return tmp
LuaJIT may outsmart this, though. In that case, creating a 1-element table could also work...
That won't work for functions that return multiple values, so a table would be needed
Just wrap tail calls like so:
function tail(...) return ... end function bar(i) print(debug.traceback()) return i + 1, i + 2 end function foo(i) -- The tail call return tail(bar(i)) end print(foo(1))
Works in both Lua 5.1 and LuaJIT.
No branches or pull requests
It would be cool if there was a CLI flag that compiled Moonscript with an avoidance of tail calls. The use case is debugging, of course.
This is probably hard to accomplish, but I figured I would make the suggestion anyway.
The text was updated successfully, but these errors were encountered: