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

Hash equality with regular sets? #1

Open
martinklepsch opened this issue Nov 13, 2015 · 2 comments
Open

Hash equality with regular sets? #1

martinklepsch opened this issue Nov 13, 2015 · 2 comments

Comments

@martinklepsch
Copy link
Owner

Undecided if hashes of regular sets should match with hashes of cc-sets. Need to better understand consequences.

@jstepien
Copy link
Contributor

On the JVM side of things, according to Oracle's docs:

If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.

The implementation indicates that a custom comparator set is Object.equals to a set with same contents:

  Object
  (equals [this that]
    (cond (identical? this that)     true
          (= (-> this seq set) that) true
          :else false))

In this light I suspect that their hashes should be equal.

@martinklepsch
Copy link
Owner Author

Thanks for the hint, sounds right 👍

That said the hashCode and hasheq + hash caching stuff isn't done properly yet I think. I don't fully understand all this stuff yet (also with regards to ClojureScript). If you want to contribute in that direction I'd be happy about your help 😃

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

2 participants