-
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
Generic details 11: operator overloading #1144
Conversation
like
operator for implicit conversionsThere 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.
LGTM, modulo the FIXME.
I'm nervous about the overall user-facing complexity, but given how long we've been beating our heads against this cluster of issues, I think this is good enough for now.
Co-authored-by: Geoff Romer <gromer@google.com>
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.
Some minor comments, but this LGTM.
Please add like
to the keyword list.
Also filed #1177 after some discussion with @chandlerc suggested that we might want to use matching names between the interface and the keyword, but that's not a blocking concern for this PR.
Done. |
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Operators rewrite to calls of specific operator interface functions, so you overload an operator for a type by implementing an interface for it. There is a `like` operator for defining a set if implementations for supporting implicit conversions more conveniently. Co-authored-by: Geoff Romer <gromer@google.com> Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Operators rewrite to calls of specific operator interface functions, so you overload an operator for a type by implementing an interface for it. There is a
like
operator for defining a set if implementations for supporting implicit conversions more conveniently.