[feature request] Compile bitwise operators into Lua BitOp functions calls
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 613
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Description
For Lua versions below 5.3, bitwise operators aren't supported. However, their behavior can be substituted using the Lua BitOp library. This library is also included by default with LuaJIT. My suggestion would be to add a boolean argument to the compiler, perhaps a --use-bit-lib (which is what Fennel also uses). In practice, it could compile the code:
bit_or = (x, y) ->
x | y
into this:
_bitop_0 = require("bit")
local bit_or
bit_or = function(x, y)
return _bitop_0.bor(x, y)
end
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by locating the compiler handling of bitwise operators and how compiler options are defined; determine how a --use-bit-lib option should affect generated Lua and verify that the example compiles to Lua BitOp calls while normal compilation remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100