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 2: adapters, associated types, parameterized interfaces #731

Merged
merged 38 commits into from
Sep 5, 2021
Merged

Conversation

josh11b
Copy link
Contributor

@josh11b josh11b commented Aug 11, 2021

This proposal goes into the details for these features of generics:

  • adapters: for creating new types compatible with existing types but with different interface implementations
  • associated types: allowing an interface implementation to specify some types to use in method signatures
  • interface parameters: creating a family of interfaces, where types can implement more than one

This is a continuation of #553 . It has been summarized in these presentations:

@josh11b josh11b added the proposal A proposal label Aug 11, 2021
@josh11b josh11b added this to Draft in Proposals via automation Aug 11, 2021
@josh11b josh11b requested a review from a team August 11, 2021 03:53
@google-cla google-cla bot added the cla: yes PR meets CLA requirements according to bot. label Aug 11, 2021
@josh11b josh11b marked this pull request as ready for review August 12, 2021 13:31
@josh11b josh11b requested a review from a team as a code owner August 12, 2021 13:31
@josh11b josh11b moved this from Draft to RFC in Proposals Aug 12, 2021
@github-actions github-actions bot added the proposal rfc Proposal with request-for-comment sent out label Aug 12, 2021
@josh11b josh11b mentioned this pull request Aug 12, 2021
Copy link
Collaborator

@wolffg wolffg left a comment

Choose a reason for hiding this comment

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

Handful of style nits, one place where you could clarify.

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

josh11b commented Aug 18, 2021

I have updated this proposal to reflect the decision made in #739.

josh11b and others added 2 commits August 18, 2021 14:15
Co-authored-by: Wolff Dobson <wolffg@users.noreply.github.com>
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.

I've only reviewed the first ~half of this for now, more to follow.

docs/design/generics/details.md Outdated Show resolved Hide resolved
docs/design/generics/details.md Outdated Show resolved Hide resolved
docs/design/generics/details.md Show resolved Hide resolved
docs/design/generics/details.md Outdated Show resolved Hide resolved
docs/design/generics/details.md Outdated Show resolved Hide resolved
docs/design/generics/details.md Outdated Show resolved Hide resolved
docs/design/generics/details.md Outdated Show resolved Hide resolved
docs/design/generics/details.md Outdated Show resolved Hide resolved
docs/design/generics/details.md Outdated Show resolved Hide resolved
docs/design/generics/details.md Outdated Show resolved Hide resolved
docs/design/generics/details.md Outdated Show resolved Hide resolved
docs/design/generics/details.md Outdated Show resolved Hide resolved
docs/design/generics/details.md Outdated Show resolved Hide resolved
docs/design/generics/details.md Outdated Show resolved Hide resolved
docs/design/generics/overview.md Outdated Show resolved Hide resolved
proposals/p0731.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.

Thanks, I'm very happy with this. I'd like confirmation from the other leads that we're OK with adapter B extends A being permitted even when A is final but that's my only blocking concern.

docs/design/generics/details.md Show resolved Hide resolved
impl as Printable { ... }
}

adapter SongByArtist extends Song {
Copy link
Contributor

Choose a reason for hiding this comment

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

OK. I think this would be useful to explicitly call out. I've made a suggestion below but feel free to ignore it and substitute your own.

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
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.

We're happy allowing adapter B for A even if A is final. Filed #813 to analyze this question further, but we don't need to block on it.

@josh11b josh11b merged commit 48d5397 into carbon-language:trunk Sep 5, 2021
Proposals automation moved this from RFC to Accepted Sep 5, 2021
@josh11b josh11b deleted the details branch September 5, 2021 22:50
@github-actions github-actions bot added proposal accepted Decision made, proposal accepted and removed proposal rfc Proposal with request-for-comment sent out labels Sep 5, 2021
chandlerc pushed a commit that referenced this pull request Jun 28, 2022
…ces (#731)

This proposal goes into the details for these features of generics:

- adapters: for creating new types compatible with existing types but with different interface implementations
- associated types: allowing an interface implementation to specify some types to use in method signatures
- interface parameters: creating a family of interfaces, where types can implement more than one

This is a continuation of #553 . It has been summarized in these presentations:

- adapters: [1](https://docs.google.com/presentation/d/1bg6q0Q9Sk4YpRbNA3D3H34xYtaEO8ScAUNUZK2UTi80/edit?resourcekey=0-6-Y6e1mfRUmHg-Zk65Gc5A#slide=id.gcf40df1c7b_0_37) and [2](https://docs.google.com/presentation/d/17KG0TeJ4OChMRdLJPS8TE_K6SoL4lFy1FUGr2CDzX-A/edit?resourcekey=0-kLnZqd5NrbGSwmbunTyB-A#slide=id.g7a37009490_0_0)
- [associated types and interface parameters](https://docs.google.com/presentation/d/19hPpUjxQ0H1lUSLy5QjS2910Cpc7UdNKpF580fFsCGw/edit?resourcekey=0-ky9XGRC1I8X0Ffw6eqh7WQ#slide=id.p)

Co-authored-by: Wolff Dobson <wolffg@users.noreply.github.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes PR meets CLA requirements according to bot. proposal accepted Decision made, proposal accepted proposal A proposal
Projects
No open projects
Proposals
Accepted
Development

Successfully merging this pull request may close these issues.

None yet

3 participants