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

Separate SupportsIntegralOps into SupportsBitLogic and SupportsBitShifting (or something) #2

Closed
posita opened this issue Nov 13, 2021 · 1 comment
Labels
invalid This doesn't seem right

Comments

@posita
Copy link
Collaborator

posita commented Nov 13, 2021

We probably want to tease out &, |, ^, ~ into their own thing. There are enough primitives that support logical operators without supporting bit-shifting (e.g., enum.Flag).

@posita posita changed the title Tease out &, |, ^, ~ from SupportsIntegralOps into SupportsLogic (or something) Tease out &, |, ^, ~ from SupportsIntegralOps into SupportsBitwiseLogic and SupportsBitShifting (or something) Nov 13, 2021
@posita posita changed the title Tease out &, |, ^, ~ from SupportsIntegralOps into SupportsBitwiseLogic and SupportsBitShifting (or something) Tease out &, |, ^, ~ from SupportsIntegralOps into SupportsBitLogic and SupportsBitShifting (or something) Nov 14, 2021
@posita posita changed the title Tease out &, |, ^, ~ from SupportsIntegralOps into SupportsBitLogic and SupportsBitShifting (or something) Separate SupportsIntegralOps into SupportsBitLogic and SupportsBitShifting (or something) Nov 14, 2021
@posita posita added the invalid This doesn't seem right label Nov 15, 2021
@posita
Copy link
Collaborator Author

posita commented Nov 15, 2021

On second thought, let's not do this. First, enum.Flag doesn't support reverse operators (e.g., __rand__). Second, other things that do support logic operators generally have specialized approaches that aren't easily generalized (see, e.g., set). I think the best solution here is to leave bit logic and bit shifting operators coupled (which likely generally applies to number-like things), and let others create/compose their own for such special cases.

@posita posita closed this as completed Nov 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

1 participant