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
Hashable instead? #1
Comments
Hi, @seivan I see your point. |
I'm thinking, that as long as every property is hashable it's class could be as well. If you're hashable, you're also going to be equatable. So why not? |
I mean the popular way to generate struct Person: Hashable {
var name: String
var age: Int
var hashValue: Int {
return name.hashValue ^ age.hashValue
}
} I wonder if its ok to generate it by default like this If so, I would consider to make a separate xcode extension under this project which will generate Because in my project for example we don't need |
I tend to use OrderedSet (custom) and Set a lot for when uniqueness matters, but that could just be me. Thanks for |
hi, @seivan, I have a implementation for this here, https://github.com/WANGjieJacques/CodeGenerator, this implementation is inspired by IntelliJ. |
Instead of
Equatable
, how aboutHashable
based on its content?It would support being used in a Set and would use the same fields as the current implementation of
Equatable
supports.The text was updated successfully, but these errors were encountered: