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

cmp.Equal doesn't work with big.Int out of the box #90

Closed
LMMilewski opened this issue Apr 27, 2018 · 2 comments
Closed

cmp.Equal doesn't work with big.Int out of the box #90

LMMilewski opened this issue Apr 27, 2018 · 2 comments

Comments

@LMMilewski
Copy link
Contributor

It would be nice if types like big.Int worked out of the box.
big.Int doesn't provide Equal method. It has Cmp though.

I don't know how common types with Cmp but no Equal are. If they're common then we could consider teaching cmp about Cmp methods. If they're not then perhaps we could make math/big provide Equal methods.

In general, it would be nice if cmp just worked with as many stdlib types as possible.

Having simple cmp.Equal work with more types would be nice but isn't a big deal either.

@nhooyr
Copy link

nhooyr commented Feb 8, 2019

Related #89

@dsnet
Copy link
Collaborator

dsnet commented Feb 17, 2019

At this point in time, I don't think we can change which methods cmp automatically looks for without breaking backwards compatibility. The workaround is to just provide a Comparer that works on an
interface{ Cmp() int }.

@dsnet dsnet closed this as completed Feb 17, 2019
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

3 participants