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

Remove Ord impl for Value #267

Open
uncomputable opened this issue Feb 10, 2025 · 0 comments
Open

Remove Ord impl for Value #267

uncomputable opened this issue Feb 10, 2025 · 0 comments

Comments

@uncomputable
Copy link
Collaborator

It makes no semantic sense to compare values of different types. Rather, PartialOrd could return None if self.ty != other.ty.

Yes -- I tried this, but we then lose Ord on Word (which maaybe makes sense, you can compare them numerically though you have to decide the relationship between 0u4 and 0u16 etc), and on Node and on Policy... so it's far-reaching.

I think the right approach would be to change Policy to implement Ord manually in alphabetical order (we do this in rust-miniscript now; it was a PITA to implement) and then we can drop Ord on the smaller types.

(see #266)

We have to see how much work it is, but making the API more semantically consistent seems worth some effort.

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

No branches or pull requests

1 participant