-
Notifications
You must be signed in to change notification settings - Fork 47
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
PartialEq implementation depends on capacity #44
Comments
Well, that sounds problematic, but the ones definition just the same, since it privileges ones over zeros 😉. Who says it's not a set of zeros? |
Well, it can get a little philosophical... :) But I guess there is some precedent to consider a
|
I think it sounds ok, even though it's not a necessary change. What do you think @jrraymond ? |
hmmm. I can see the argument for. Although I have reservations about making such a breaking change given that this is the first time a user has raised this issue in the ~3 years since bluss created petgraph. |
It is reasonable to expect the capacity of a set is not semantically meaningful. With It is also reasonable to expect that the capacity/size (ie number of bits not number of ones) of a bit set is semantically meaningful, for example the C++ std library bitset the size is part of the type of the set. |
I hear the counter argument @jrraymond , I think it makes sense from the Maybe the doc can just be clearer around this case, but I agree for most users that is irrelevant :D |
Hello,
Thanks a lot for the awesome lib 👍
I've observed that
PartialEq
is derived automatically. But that means that sets with different capacities are always considered different, even when having the same "elements" (in the sense of the values obtained withones()
).Wouldn't it be better to consider sets that return the same values when iterated over with
ones()
as equal, regardless of their internal capacities? That would be more in line with how the standard library works, forVec
and other data structures.This could arguably be a breaking change though, not sure the maintainers would be ok with this.
I'll be glad to work on a PR for this change if well received.
Best regards,
The text was updated successfully, but these errors were encountered: