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

feat: make all instructions and contents Eq and Hash #374

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kalzoo
Copy link
Contributor

@kalzoo kalzoo commented Jun 5, 2024

Make Instruction and all of its sub-structs both Hash and Eq:

  • Handle f64 equality as NaN == NaN which is defensible in the case of equating instructions
  • Handle IndexMap equality by relying on iteration order. This is suboptimal in that ordering shouldn't matter for equality checks, but sorting them would be expensive. This is where BTreeMap may actually make more sense, but that doesn't need to be addressed here. This was discussed in the past and I recall that there was a good reason not to select it, even if I forget that reason now.

TODO

  • right now, we just impl Eq for TypeX when it contains f64, which in effect will just cause a panic when one of those f64 is NaN. this should be better handled and possibly include a PartialEq override.

Copy link

github-actions bot commented Jun 5, 2024

PR Preview Action v1.4.7
🚀 Deployed preview to https://rigetti.github.io/quil-rs/pr-preview/pr-374/
on branch quil-py-docs at 2024-06-05 23:59 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant