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

Generic details 11: operator overloading #1144

Merged
merged 24 commits into from
Apr 8, 2022
Merged

Generic details 11: operator overloading #1144

merged 24 commits into from
Apr 8, 2022

Conversation

josh11b
Copy link
Contributor

@josh11b josh11b commented Mar 17, 2022

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.

@josh11b josh11b added the proposal A proposal label Mar 17, 2022
@josh11b josh11b requested a review from a team March 17, 2022 19:55
@josh11b josh11b changed the title Generic details 11: like operator for implicit conversions Generic details 11: operator overloading Mar 17, 2022
@josh11b josh11b marked this pull request as ready for review March 21, 2022 17:37
@josh11b josh11b requested a review from a team as a code owner March 21, 2022 17:37
@github-actions github-actions bot added the proposal rfc Proposal with request-for-comment sent out label Mar 21, 2022
toolchain/diagnostics/BUILD Outdated Show resolved Hide resolved
Copy link
Contributor

@geoffromer geoffromer left a 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.

docs/design/generics/details.md Outdated Show resolved Hide resolved
docs/design/generics/details.md Outdated Show resolved Hide resolved
Copy link
Contributor

@zygoloid zygoloid left a 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.

docs/design/generics/details.md Show resolved Hide resolved
proposals/p1144.md Outdated Show resolved Hide resolved
proposals/p1144.md Outdated Show resolved Hide resolved
@josh11b
Copy link
Contributor Author

josh11b commented Apr 8, 2022

Please add like to the keyword list.

Done.

@josh11b josh11b merged commit 853a745 into carbon-language:trunk Apr 8, 2022
@josh11b josh11b deleted the like branch April 8, 2022 21:51
@github-actions github-actions bot added proposal accepted Decision made, proposal accepted and removed proposal rfc Proposal with request-for-comment sent out labels Apr 8, 2022
chandlerc pushed a commit that referenced this pull request Jun 28, 2022
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>
@chandlerc chandlerc added the documentation An issue or proposed change to our documentation label Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation An issue or proposed change to our documentation proposal accepted Decision made, proposal accepted proposal A proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants