-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
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
Support luajit native bit library instead of bit32 #723
Comments
Hi! Thanks for looking at Teal :) @fperrad has also asked for this recently, and even sent a PR... At the time, I declined having this behavior be automatic, and wrote down my reasoning: #686 I'm not 100% opposed to making this into a compiler option (cautiously saying this while being afraid of opening Pandora's Box) but I still want Teal's default behavior to be as consistent as possible on every supported Lua version (within some pragmatic limits). |
At this time, with an unmodified |
Maybe add local bit32 = bit32; if not bit32 then local p, m = pcall(require, 'bit32'); if p then bit32 = m elseif p, m = pcall(require, 'bit'); if p then bit32 = m end end end; --... |
I understand the fear of opening Pandora's box, but I'd really like to be able to have something like teal for luajit based runtimes. Lua is just too slow for the types of projects I work on and the main drawback of luajit is the lack of proper types in the tooling. Native teal support for luvit and openresty apps would be amazing! Creating a competing teal-like project that targets luajit seems silly and a waste of effort. I hope there is a way to support luajit properly without causing undue burden on this project. |
@creationix Thanks again for the feedback. I think a way out of this conundrum (and similar ones in general) will be to introduce compiler flags not only at the CLI level, but at the module-file level as special comments, like https://wiki.haskell.org/Language_Pragmas (related: https://github.com/seanbaxter/circle/blob/master/new-circle/README.md#versioning-with-feature-directives ) |
see #751 |
I would love to be able to use teal with luajit based runtimes. As you know, luajit has a nice bit library built-in that is the same or very similar as
bit32
. I need a way to configure luajit as the runtime that tweaks the generated code.The text was updated successfully, but these errors were encountered: