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

Types are values of type type #2360

Merged

Conversation

zygoloid
Copy link
Contributor

@zygoloid zygoloid commented Oct 28, 2022

Define a "type" to be a value of type type. Contexts expecting a type perform an implicit conversion to type. Values like () and (i32, i32) and {} are no longer types, but instead implicitly convert to type. Values of interface or constraint type (now called "facets") are similarly not formally types but implicitly convert to type.

@zygoloid zygoloid added proposal A proposal proposal draft Proposal in draft, not ready for review labels Oct 28, 2022
@zygoloid zygoloid marked this pull request as ready for review October 29, 2022 01:01
@github-actions github-actions bot added proposal rfc Proposal with request-for-comment sent out and removed proposal draft Proposal in draft, not ready for review labels Oct 29, 2022
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.

I did a quick review while its still fresh in my mind, and this largely matches my understanding of our discussions!

I'm pretty happy w/ the improved story across the board here. A somewhat minor added bit of prose suggested inline.

proposals/p2360.md Outdated Show resolved Hide resolved
josh11b added a commit to josh11b/carbon-lang that referenced this pull request Oct 29, 2022
proposals/p2360.md Show resolved Hide resolved
proposals/p2360.md Outdated Show resolved Hide resolved
proposals/p2360.md Outdated Show resolved Hide resolved
proposals/p2360.md Outdated Show resolved Hide resolved
proposals/p2360.md Outdated Show resolved Hide resolved
proposals/p2360.md Show resolved Hide resolved
zygoloid and others added 6 commits October 31, 2022 14:04
Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
Co-authored-by: josh11b <josh11b@users.noreply.github.com>
Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
proposals/p2360.md Outdated Show resolved Hide resolved
proposals/p2360.md Outdated Show resolved Hide resolved
proposals/p2360.md Outdated Show resolved Hide resolved
proposals/p2360.md Outdated Show resolved Hide resolved
@zygoloid zygoloid changed the title Types are values of type Type Types are values of type type Nov 10, 2022
Add a bunch of examples.
@chandlerc chandlerc self-requested a review December 22, 2022 04:53
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.

Approving for leads, this seems ready to land.

FWIW, I do think there are two things to keep our eyes on:

  1. As mentioned in the proposal, we may need to revisit the whole tuple situation if this approach proves too confusing. But I think that's a fine fix-forward to keep open.

  2. We may want to revisit or tweak the precise terminology. I even have some ideas of what might be an improvement here, but they seem better considered as incremental changes in the future rather than trying to keep iterating here.

If Josh is happy merging my typo fix, one of us can likely merge the whole PR afterward.

proposals/p2360.md Outdated Show resolved Hide resolved
Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
@chandlerc chandlerc merged commit 16dcdc2 into carbon-language:trunk Dec 22, 2022
zygoloid added a commit to zygoloid/carbon-lang that referenced this pull request Jan 3, 2023
zygoloid added a commit to zygoloid/carbon-lang that referenced this pull request Jan 4, 2023
Also make minor updates to the skeletal design in
docs/design/name_lookup.md following carbon-language#2113, as there are no longer any
prelude names that are made available to unqualified name lookup by
default.

Add `type` to the keyword list in
docs/design/lexical_conventions/words.md, following carbon-language#2360.
jonmeow pushed a commit that referenced this pull request Jan 4, 2023
Also make minor updates to the skeletal design in
docs/design/name_lookup.md following #2113, as there are no longer any prelude names that are made available to unqualified name lookup by default.

Add `type` to the keyword list in
docs/design/lexical_conventions/words.md, following #2360.
@josh11b josh11b mentioned this pull request Apr 11, 2023
github-merge-queue bot pushed a commit that referenced this pull request 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 <gromer@google.com>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
@josh11b josh11b mentioned this pull request Aug 3, 2023
github-merge-queue bot pushed a commit that referenced this pull request 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 <richard@metafoo.co.uk>
github-merge-queue bot pushed a commit that referenced this pull request Aug 30, 2023
Change terminology away from terms that are ambiguous:

- Reserve "generic type" for types with (compile-time) parameters, like
`Vector` in `Vector(T:! type)`. Don't use that term to refer to `T`, as
it would with
[#2360](https://github.com/carbon-language/carbon-lang/blob/trunk/proposals/p2360.md#terminology).
- Use the term "compile-time" instead of "constant" to mean "template or
symbolic." Expand the term "constant" to include values, such as from
`let` bindings.
github-merge-queue bot pushed a commit that referenced this pull request Aug 31, 2023
Most changes are due to proposal #2360, but this also includes changes
to reflect: #1136, #2138, #2006, #2550, and #2964.

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
github-merge-queue bot pushed a commit that referenced this pull request Sep 8, 2023
Incorporates proposals: #1885, #2138, #2188, #2200, #2360, #2760, #2964,
and #3162.

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
github-merge-queue bot pushed a commit that referenced this pull request Sep 19, 2023
First step in updating `docs/design/generics/details.md`. It
incorporates changes from proposals: #989 #2138 #2173 #2200 #2360 #2964
#3162 , but there are still more changes from those proposals to be
made.

It also switches away from suggesting static-dispatch witness tables,
and creates an appendix to describe that decision.

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
github-merge-queue bot pushed a commit that referenced this pull request Sep 23, 2023
Includes proposals:
- #990
- #2188
- #2138
- #2200
- #2360
- #2760
- #2964
- #3162

Also tries to use more precise language when talking about:
- implementations, to avoid confusing `impl` declaration and definitions
with the `impls` operator used in `where` clauses, an issue brought up
in #2495 and #2483;
- "binding patterns", like `x: i32`, and "bindings" like `x`.

---------

Co-authored-by: Chandler Carruth <chandlerc@gmail.com>
github-merge-queue bot pushed a commit that referenced this pull request Oct 3, 2023
Continued from part 1: #3231. Second step updating
`docs/design/generics/details.md`. There remains some work to
incorporate proposal #2200.

- The biggest changes are incorporating much of the text of proposals:
  - #2173
  - #2687
- It incorporates changes from proposals:
  - #989
  - #1178
  - #2138
  - #2200
  - #2360
  - #2964
  - #3162
- It also updates the text to reflect the latest thinking from leads
issues:
  - #996
  - #2153 -- most notably deleting the section on `TypeId`.
- Update to rule for prioritization blocks with mixed type structures
from [discussion on
2023-07-18](https://docs.google.com/document/d/1gnJBTfY81fZYvI_QXjwKk1uQHYBNHGqRLI2BS_cYYNQ/edit?resourcekey=0-ql1Q1WvTcDvhycf8LbA9DQ#heading=h.7jxges9ojgy3)
- Adds reference links to proposals, issues, and discussions relevant to
the text.
- Also tries to use more precise language when talking about
implementations, to avoid confusing `impl` declaration and definitions
with the `impls` operator used in `where` clauses, an issue brought up
in
  - #2495 
  - #2483

---------

Co-authored-by: Richard Smith <richard@metafoo.co.uk>
@zygoloid zygoloid deleted the proposal-types-are-values-of- branch October 4, 2023 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal rfc Proposal with request-for-comment sent out proposal A proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants