Dictu
Dictu copied to clipboard
[FEATURE] move bitwise operators into standard library
Is there an existing issue for this?
- [X] I have searched the existing issues
Is your feature request related to a problem?
If iterators, fibers, or other features are going to be added to Dictu, other features should be taken out so that the source doesn't become bloated. Bitwise operations are a good candidate: they are rarely used in high-level languages and they can easily be provided as native functions in the standard library.
Describe the solution you'd like
- Remove
&,|,~,^,<<,>>, and associated update operators from the scanner and compiler. (I can do this.) - Provide native functions
bit_xyzto replace them. (I can do this.)
Describe alternatives you've considered
No response
Additional context
No response
This is an interesting proposition, I can't think of any language off the top of my head that doesn't implement them as operators rather than all as builtins (not to say there aren't any languages, I'm sure there are). Obviously other languages don't have to define Dictu, but deviation is extra learning.
Operators do cause a bit of bloat within the compiler at the moment as there are about 3 places that need to be changed when adding a new operator, so I'm not entirely opposed to the idea.
FORTRAN didn't have 'em, but I'm showing my age there :-) More seriously, I think Dictu's already a medium-sized language; if more features are going to go in, it's the right time to think about what can be taken out. Bit ops are an obvious candidate...
Hah thats interesting, I can't say i've ever used FORTRAN! I'd potentially be up for moving bitwise ops but I think having them behind some sort of namespace would probably be advised. I'm trying to keep the amount of non-namespaced builtins low to stop the chance of unknown shadowing (although for bitwise funcs thats probably going to be a pretty low chance).
I'm not sure which namespace they would live behind yet though 😅 Perhaps even a new one which can be extended with other bit-twiddling functionality at a later date