Skip to content
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

Change bitwise operators to coerce operands to integers #10

Closed
ecton opened this issue Nov 18, 2022 · 0 comments
Closed

Change bitwise operators to coerce operands to integers #10

ecton opened this issue Nov 18, 2022 · 0 comments
Labels
budlang Issues related to the Bud language

Comments

@ecton
Copy link
Member

ecton commented Nov 18, 2022

Currently if a non-integer Value is encountered, the bitwise operators degrade to boolean operators (without short circuiting). Because these are dedicated operators, we should instead try converting the operands to integers and then performing the bitwise operation. This is more likely to catch programmatic errors than the other behavior.

@ecton ecton added the budlang Issues related to the Bud language label Nov 18, 2022
ecton added a commit that referenced this issue Nov 19, 2022
Refs #10.

While the original idea I had was to coerce, I decided that I'd prefer
clear type conversion boundaries. I think dynamic types should still be
able to coerce to integer, however, so I'm leaving #10 open.

This change introduces Bitwise and Logical instruction variants for or,
xor, and and. The bud language itself doesn't change, but the underlying
behavior does.
@ecton ecton closed this as completed in 1dcab87 Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
budlang Issues related to the Bud language
Projects
None yet
Development

No branches or pull requests

1 participant