-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Implicit conversions for aggregates #981
Conversation
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.
Looks good to me.
docs/design/classes.md
Outdated
For example, since | ||
[comparison between `i32` and `u32` is defined](/proposals/p0702.md#built-in-comparisons-and-implicit-conversions), | ||
equality comparison between values of types `{.x: i32, .y: i32}` and | ||
`{.y: u32, .x: u32}` is as well. |
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.
I think we should say what order the fields are compared in. IIRC we said we'd use the order of the left-hand operand so that the order of operations in ==
matches =
. Eg, "Equality and inequality comparisons compare fields using the field order of the left-hand operand and stop once the outcome of the comparison is determined. However, the comparison order and short-circuiting are generally expected to affect only the performance characteristics of the comparison and not its meaning."
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.
I agree, added.
proposals/p0981.md
Outdated
|
||
Rather than picking the left-hand argument's field order when the orders were | ||
different, we considered requiring the field order to match when performing | ||
comparisons. An explicit conversion to a common type would be required to |
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.
comparisons. An explicit conversion to a common type would be required to | |
equality comparisons. An explicit conversion to a common type would be required to |
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.
I made a larger change.
Co-authored-by: Richard Smith <[email protected]>
LGTM as well!!! |
Define initialization, assignment, comparison, and implicit conversion between data classes with different field orders and/or types. Implements the decision made in #710 . Co-authored-by: Richard Smith <[email protected]>
Define initialization, assignment, comparison, and implicit conversion between data classes with different field orders and/or types.
Implements the decision made in #710 .