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

Equality implementation #75

Open
amis92 opened this issue Aug 5, 2019 · 2 comments
Open

Equality implementation #75

amis92 opened this issue Aug 5, 2019 · 2 comments
Milestone

Comments

@amis92
Copy link
Owner

amis92 commented Aug 5, 2019

I thought we agreed to use direct operator equality/valuetuple equality. That might come later.

Originally posted by @amis92 in #56


There are a couple of areas where we can certainly improve. Let's list them and discuss them.

@amis92
Copy link
Owner Author

amis92 commented Aug 6, 2019

Found a problem as well, GeneratedCodeAttribute isn't applied on generated operator overloads (==/!=)

edit: moved to #77

@amis92
Copy link
Owner Author

amis92 commented Jan 6, 2020

operator == should defer to direct left.Equals(right) call instead of using EqualityComparer.

This could be an optimization when we know we implement ObjectEquals and/or EquatableEquals. If not, we could probably check if the input class already implements either and if so, use that as well.

Prioritization of calls should be:

  1. IEquatable<T>.Equals(T) if interface is implemented (by us or not)
  2. object.Equals(object) if overridden
  3. EqualityComparer<T>.Equals(T, T) as a fallback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant