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

Generics details 7: final impls #983

Merged
merged 8 commits into from
Jan 4, 2022
Merged

Generics details 7: final impls #983

merged 8 commits into from
Jan 4, 2022

Conversation

josh11b
Copy link
Contributor

@josh11b josh11b commented Dec 10, 2021

Add support for marking impls as final to say they can't be specialized. This allows generic functions that see that the impl applies to determine the values for its associated types. For example this allows us to say that the implementation of the Deref interface for pointers can't be specialized. Otherwise, *p could have unknown type in a generic function.

@josh11b josh11b added the proposal A proposal label Dec 10, 2021
@josh11b josh11b requested a review from a team December 10, 2021 21:49
@josh11b josh11b marked this pull request as ready for review December 15, 2021 01:18
@josh11b josh11b requested a review from a team as a code owner December 15, 2021 01:18
@github-actions github-actions bot added the proposal rfc Proposal with request-for-comment sent out label Dec 15, 2021
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.

Looks good to me.

Copy link
Contributor

@chandlerc chandlerc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice, just some trivial clarification stuff below. Optional, take or leave. =D

proposals/p0983.md Outdated Show resolved Hide resolved
proposals/p0983.md Outdated Show resolved Hide resolved
josh11b and others added 2 commits December 16, 2021 08:17
Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
@josh11b josh11b merged commit 7ffcbc0 into carbon-language:trunk Jan 4, 2022
@josh11b josh11b deleted the final branch January 4, 2022 22:17
@github-actions github-actions bot added proposal accepted Decision made, proposal accepted and removed proposal rfc Proposal with request-for-comment sent out labels Jan 4, 2022
chandlerc added a commit that referenced this pull request Jun 28, 2022
Add support for marking impls as `final` to say they can't be specialized. This allows generic functions that see that the impl applies to determine the values for its associated types. For example this allows us to say that the implementation of the `Deref` interface for pointers can't be specialized. Otherwise, `*p` could have unknown type in a generic function.

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal accepted Decision made, proposal accepted proposal A proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants