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

Values, variables, pointers, and references #2006

Merged
merged 100 commits into from
Aug 8, 2023

Conversation

chandlerc
Copy link
Contributor

@chandlerc chandlerc commented Aug 12, 2022

Introduce a concrete design for how Carbon values, objects, storage, variables,
and pointers will work. This includes fleshing out the design for:

  • The expression categories used in Carbon to represent values and objects,
    how they interact, and terminology that anchors on their expression nature.
  • An expression category model for readonly, abstract values that can
    efficiently support function inputs.
  • A customization system for value expression representations, especially as
    seen on function boundaries in the calling convention.
  • An expression category model for references instead of a type system model.
  • How patterns match different expression categories.
  • How initialization works in conjunction with function returns.
  • Specific pointer syntax, semantics, and library customization mechanisms.
  • A const type qualifier for use when the value expression category system
    is too abstracted from the underlying objects in storage.

@chandlerc chandlerc added the proposal A proposal label Aug 12, 2022
@chandlerc chandlerc requested a review from a team August 12, 2022 04:16
@jonmeow jonmeow added the proposal draft Proposal in draft, not ready for review label Aug 12, 2022
@OlaFosheimGrostad

This comment was marked as outdated.

@github-actions

This comment was marked as outdated.

@github-actions github-actions bot added the inactive Issues and PRs which have been inactive for at least 90 days. label Mar 25, 2023
Pixep added a commit to Pixep/carbon-lang that referenced this pull request Mar 29, 2023
jonmeow pushed a commit that referenced this pull request Mar 30, 2023
Replaces references to PR #821 (closed) by #2006 (draft) which tracks the same feature definition.
@chandlerc chandlerc closed this Mar 30, 2023
@chandlerc chandlerc added long term Issues expected to take over 90 days to resolve. and removed inactive Issues and PRs which have been inactive for at least 90 days. labels Mar 30, 2023
@chandlerc chandlerc reopened this Mar 30, 2023
Copy link
Contributor Author

@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.

Thanks for all the feedback, and sorry for delay getting a new revision -- I think I've addressed all of this feedback. I've resolved the threads that were really clearly addressed and responded to the rest. PTAL!

docs/design/values.md Outdated Show resolved Hide resolved
docs/design/values.md Outdated Show resolved Hide resolved
docs/design/values.md Outdated Show resolved Hide resolved
proposals/p2006.md Outdated Show resolved Hide resolved
docs/design/expressions/README.md Show resolved Hide resolved
docs/design/values.md Outdated Show resolved Hide resolved
docs/design/values.md Outdated Show resolved Hide resolved
docs/design/README.md Outdated Show resolved Hide resolved
docs/design/expressions/type_operators.md Show resolved Hide resolved
docs/design/expressions/type_operators.md Outdated Show resolved Hide resolved
@chandlerc chandlerc requested a review from zygoloid August 5, 2023 04:23
docs/design/expressions/type_operators.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.

Awesome! Looks good to merge.

proposals/p2006.md Show resolved Hide resolved
Copy link
Contributor Author

@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.

Merging, many thanks to the so many folks who helped with this one. =D

@chandlerc chandlerc added this pull request to the merge queue Aug 8, 2023
Merged via the queue into carbon-language:trunk with commit 0d1e6bd Aug 8, 2023
6 checks passed
@chandlerc chandlerc deleted the pointers2 branch August 8, 2023 07:31
zygoloid added a commit to zygoloid/carbon-lang that referenced this pull request Aug 10, 2023
Also indicate what can appear within parentheses.

This is intended to be a clarification, not a design change. Note that
while we previously described the operand of `++` or `--` as being
simply an expression, the operand can never be anything other than the
kinds of expression the diagram now shows due to the expression category
rules added in carbon-language#2006.

Fixes carbon-language#3079.
zygoloid added a commit to zygoloid/carbon-lang that referenced this pull request Aug 10, 2023
Also indicate what can appear within parentheses.

This is intended to be a clarification, not a design change. Note that
while we previously described the operand of `++` or `--` as being
simply an expression, the operand can never be anything other than the
kinds of expression the diagram now shows due to the expression category
rules added in carbon-language#2006.

Fixes carbon-language#3079.
github-merge-queue bot pushed a commit that referenced this pull request Aug 10, 2023
…am. (#3083)

Also indicate what can appear within parentheses.

This is intended to be a clarification, not a design change. Note that
while we previously described the operand of `++` or `--` as being
simply an expression, the operand can never be anything other than the
kinds of expression the diagram now shows due to the expression category
rules added in #2006.

Fixes #3079.
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 <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Sep 20, 2023
This implements initializing expression semantics for structs and
tuples, following #2006 and discussions since.

Tuple and (and analogously, struct) literals are treated as having a
mixed expression category that is later resolved based on how the
literal is used, as either a tuple initializer or a tuple value, at
which point we create a `TupleInit` or `TupleValue` that represents the
formation of the tuple initializer or tuple value from the tuple
literal.

There's quite a lot of TODOs here, and the SemIR representation is still
not quite right, but this seems like a good place to checkpoint some
incremental progress.
@zygoloid zygoloid mentioned this pull request Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
long term Issues expected to take over 90 days to resolve. 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.

None yet

8 participants