-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Update spec for record value equality #3396
Conversation
proposals/records-wip.md
Outdated
`T Equals(T)` is specified to perform value equality, comparing the property with same name as | ||
each primary constructor parameter to the corresponding property of the other type. | ||
`T Equals(T)` is specified to perform value equality such that `Equals` is | ||
true if and only if all the instance fields of the receiver type are equal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
equal [](start = 69, length = 5)
I don't know what equals
means. How is this possible, given that the fields of the base class might not be accessible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the exact same language the spec uses for anonymous types, so if it's underspecified, that's an existing problem :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, anonymous types don't have a base class. In any case, some other existing text being underspecified isn't an excuse. I think you should just say object.Equals(x, y)
(and mention as an aside that the implied boxing may be elided)
In reply to: 418282509 [](ancestors = 418282509)
attribute or modifier? If it is contextual, what, precisely, is the context? Can it be placed between two other attributes? Can you please show the modified attributes production, if it is modified? Refers to: proposals/records-wip.md:30 in 04e750a. [](commit_id = 04e750a, deletion_comment = False) |
Syntactic issues shouldn't be relevant to this PR, so I'll deal with them later |
@@ -67,8 +67,10 @@ Record types produce synthesized implementations for the following methods: | |||
* `object.Equals(object)` override, unless it is sealed or user provided | |||
* `T Equals(T)` method, where `T` is the current type | |||
|
|||
`T Equals(T)` is specified to perform value equality, comparing the property with same name as | |||
each primary constructor parameter to the corresponding property of the other type. | |||
`T Equals(T)` is specified to perform value equality such that `Equals` is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
specified [](start = 17, length = 9)
Where can we find this specification you speak of? ;)
No description provided.