Skip to content

[Version 10.0] Feature support for record structs#1556

Draft
RexJaeschke wants to merge 11 commits into
draft-v10from
v10-record-structs
Draft

[Version 10.0] Feature support for record structs#1556
RexJaeschke wants to merge 11 commits into
draft-v10from
v10-record-structs

Conversation

@RexJaeschke

@RexJaeschke RexJaeschke commented Jan 28, 2026

Copy link
Copy Markdown
Contributor

The original version of this PR has been modified based on Issue #1683.

This is Rex's adaptation of the corresponding MS proposal.

@RexJaeschke RexJaeschke added this to the C# 10 milestone Jan 28, 2026
@RexJaeschke RexJaeschke added type: feature This issue describes a new feature Review: pending Proposal is available for review labels Jan 28, 2026
@RexJaeschke
RexJaeschke marked this pull request as draft January 28, 2026 16:41
Comment thread standard/structs.md
;

record_struct_body
: struct_body ';'?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The optional trailing semicolon was not mentioned in the MS proposal; however, I discovered that VS 2026 18.2.1 allows it (just as we allow it for record classes). What was the intent here?

RexJaeschke and others added 10 commits June 24, 2026 14:58
Remove unnecessary blank lines from classes.md
- Grammar allows `record` and `record class`
- `with` expressions allowed in non-record struct types
- a couple small merge issues where text was lost
@BillWagner
BillWagner force-pushed the v10-record-structs branch from 9f994ae to 36f3bcf Compare June 24, 2026 18:58
@BillWagner

Copy link
Copy Markdown
Member

An earlier version of this feature is already present on alpha-v10 from a prior meeting. Edits made to this PR since then are not yet on alpha-v10; they will land at the next propagation. If you need them on alpha-v10 sooner, please open a separate PR targeting alpha-v10.
Thanks!

@RexJaeschke

Copy link
Copy Markdown
Contributor Author

After researching and writing-up "Primary constructors" as a general feature in v12 for classes and structs outside of record variants, I have made a lot of tweaks to this spec (and to the V9 record class spec) to ease the transition to that v12 spec.

BillWagner added a commit that referenced this pull request Jul 24, 2026
…olutions: record class type qualifier on with-expr clone (§15.16.6.4), record/non-record struct copy-by-value, record_class_declaration 'record class' spelling, positional-param inherited-field clause
BillWagner added a commit that referenced this pull request Jul 24, 2026
… A): structs.md:437 -> record-class primary ctor concept anchor; structs.md:256 parenthetical removed (no valid v10 target)
@BillWagner

Copy link
Copy Markdown
Member

I attempted to rebase this PR onto the updated draft-v10 after the latest TC49-TG2 committee meeting but encountered conflicts that need author resolution. Please rebase locally onto draft-v10 and resolve them. Thanks!

@BillWagner

Copy link
Copy Markdown
Member

While rebuilding alpha-v10 for the alpha preview, two §xx placeholders in standard/structs.md were resolved provisionally, for the preview only:

  • structs.md (record-struct primary constructor): resolved to §15.16.6.6.2 (record-class primary constructor), concept-anchor style so renumber keeps it current.
  • structs.md (non-record-struct primary constructor): the ([§xx](classes.md#xx)) parenthetical was removed entirely — there is no valid v10 target — leaving "…has a primary constructor provided by the implementation".

These are preview-only resolutions and are not a substitute for the author's intended wording. Please finalize the correct cross-references/wording in this PR. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review: pending Proposal is available for review type: feature This issue describes a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants