onmyway133 / DeepDiff

🦀Amazingly incredible extraordinary lightning fast diffing in Swift
https://onmyway133.com/apps/
Other
2.05k stars 145 forks source link

Make diffId Hashable, rather than Int #35

Closed jlawton closed 5 years ago

jlawton commented 5 years ago

The requirement that diffId is Int means that I have to hash my input value, only to have it re-hashed when used internally as a dictionary key. I don't think it really adds much complexity to require instead that diffId is Hashable. I don't think it too likely to have to constrain the type in client code, in practice, so it shouldn't add much cognitive or code overhead.

This was already discussed in https://github.com/onmyway133/DeepDiff/pull/28/files#r259297434 but left as Int, for simplicity.

onmyway133 commented 5 years ago

@jlawton Thanks for the PR. In fact, the algorithm requires only Hashable, and this shouldn't introduce breaking changes at all. 👍