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

Terminology for internal and external implementations #2770

Closed
josh11b opened this issue Apr 14, 2023 · 7 comments
Closed

Terminology for internal and external implementations #2770

josh11b opened this issue Apr 14, 2023 · 7 comments
Labels
leads question A question for the leads team

Comments

@josh11b
Copy link
Contributor

josh11b commented Apr 14, 2023

The decision #995 retires the keyword external to mark external implementations, and instead uses extend to mark internal implementations. Should we change the terminology in the documentation to match? If so, what terminology should we use instead?

@josh11b josh11b added the leads question A question for the leads team label Apr 14, 2023
@chandlerc
Copy link
Contributor

I think we should change to match.

"extended implementations" and "implementations" would be my initial suggestions.

There is a question of how important it is to have a dedicated or positive term for the non-extended case?

@josh11b
Copy link
Contributor Author

josh11b commented Apr 14, 2023

The non-extended case has different rules, for example:

  • external implementations may be defined in different libraries
  • blanket implementations must be external

@chandlerc
Copy link
Contributor

The non-extended case has different rules.

Yes, but that alone doesn't make it clear to me how important it is to have a dedicated term? I'm guessing you're trying to say that it is somewhat important, but I'm still not sure where that leaves things.

I also don't have any ideas for what the term should be here, but if you or others do, then maybe its a moot point.

Unrelated minor question:

  • blanket implementations must be external

Isn't this just conditional blanket implementations? I may be getting confused though.

@josh11b
Copy link
Contributor Author

josh11b commented Apr 17, 2023

Isn't this just conditional blanket implementations? I may be getting confused though.

We don't say "conditional blanket implementations" since it is redundant, all blanket implementations are of the form "for all types satisfying a criteria..."

@mconst
Copy link
Contributor

mconst commented Apr 19, 2023

I'd avoid introducing a separate term for non-extended impls. I think your examples both become clearer if we phrase them in terms of where you're allowed to write extend:

  • blanket implementations must be external

I'd say "you can't extend a blanket impl".

  • external implementations may be defined in different libraries

This one feels kind of obvious given #995, so we might not need to state it at all. But if it comes up, I'd say something like "you can't use extend outside the class definition, but you can always impl your own interface for the class and then call those methods using qualified member access".

In general, to get the maxmium benefit from #995, I think we should try to treat impl and extend as separate concepts as much as possible. If we run into a lot of cases where that doesn't work, then that would be a sign to maybe revisit #995, but these examples seem like they fit the model nicely.

@josh11b
Copy link
Contributor Author

josh11b commented Apr 26, 2023

In general, to get the maxmium benefit from #995, I think we should try to treat impl and extend as separate concepts as much as possible. If we run into a lot of cases where that doesn't work, then that would be a sign to maybe revisit #995, but these examples seem like they fit the model nicely.

I find this argument compelling.

@josh11b
Copy link
Contributor Author

josh11b commented May 13, 2023

I'm in an airport with two leads, and we agree with the resolution and rationale from #2770 (comment)

@josh11b josh11b closed this as completed May 13, 2023
josh11b added a commit to josh11b/carbon-lang that referenced this issue May 16, 2023
zygoloid added a commit that referenced this issue Jun 15, 2023
Update syntax of `class` and `interface` definitions to be more consistent. Constructs that add names to the class or interface from another definition are always prefixed by the `extend` keyword.

Implements the decisions in:

-   [#995: Generics external impl versus extends](#995),
-   [#1159: adaptor versus adapter may be harder to spell than we'd like](#1159),
-   [#2580: How should Carbon handle conditionally implemented internal interfaces](#2580), and
-   [#2770: Terminology for internal and external implementations](#2770).

Co-authored-by: Richard Smith <[email protected]>
github-merge-queue bot pushed a commit that referenced this issue Aug 2, 2023
This reflects changes from a number of approved proposals:
- #920 : concrete statements about orphan and overlap in Carbon
- #2138 : "generic" -> "checked generic", "template" -> "template
generic"
- #2188 : binding patterns are forbidden in type position
- #2360 : "type", "facet type", "facet". Note: I am not using the term
"generic type" from #2360 since that meaning conflicts with the
generally accepted meaning of "generic type" of a type with a
compile-time parameter.
- #2760 / #2770 : internal/external impl -> extending impl
- #2964 : "symbolic constant" and "template constant"

---------

Co-authored-by: Geoff Romer <[email protected]>
Co-authored-by: Richard Smith <[email protected]>
github-merge-queue bot pushed a commit that referenced this issue Aug 15, 2023
This reflects changes from a number of approved proposals:

- #2138 : "generic" -> "checked generic", "template" -> "template
generic"
- #2360 : "type", "facet type", "facet". Note: I am not using the term
"generic type" from #2360 since that meaning conflicts with the
generally accepted meaning of "generic type" of a type with a
compile-time parameter.
- #2760 / #2770 : internal/external impl -> extending impl
- #2964 : "symbolic constant" and "template constant"

---------

Co-authored-by: Richard Smith <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
leads question A question for the leads team
Projects
None yet
Development

No branches or pull requests

3 participants