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

Subscript syntax and semantics #2274

Merged
merged 11 commits into from
Nov 9, 2022
Merged

Conversation

geoffromer
Copy link
Contributor

@geoffromer geoffromer commented Oct 7, 2022

Adds support for subscripting using the conventional square-bracket syntax, with support for both array-like and slice-like semantics.

Cloned from #1356, which was cloned from #1059

@geoffromer geoffromer marked this pull request as ready for review October 7, 2022 23:44
@github-actions github-actions bot requested a review from jonmeow October 7, 2022 23:44
@geoffromer geoffromer added proposal A proposal proposal rfc Proposal with request-for-comment sent out labels Oct 7, 2022
@geoffromer geoffromer requested review from josh11b and zygoloid and removed request for jonmeow October 7, 2022 23:52
Copy link
Contributor

@josh11b josh11b 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! My only concern is making the rewrite depend on whether lhs is an l-value, but I don't have a good alternative to offer instead.

proposals/p2274.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.

Looks good to me.

proposals/p2274.md Outdated Show resolved Hide resolved
proposals/p2274.md Show resolved Hide resolved
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 think we may want to tweak or simplify this in the future depending on exactly how R-values work out, but I don't think it's useful to wait for that. Progress > perfection, let's ship this.

@chandlerc chandlerc added proposal accepted Decision made, proposal accepted and removed proposal rfc Proposal with request-for-comment sent out labels Nov 9, 2022
@geoffromer geoffromer merged commit 4885a2b into carbon-language:trunk Nov 9, 2022
@geoffromer geoffromer deleted the subscript branch November 9, 2022 19:50
chandlerc pushed a commit that referenced this pull request Dec 10, 2022
Update the design documentation to reflect #2274.

The contents are largely copy-pasted from p2274.md with minor edits, but the "Open questions" section is new.
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.

4 participants