Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Version 9.0] Feature support for records#1458

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
BillWagner wants to merge3 commits intodraft-v9
base:draft-v9
Choose a base branch
Loading
fromv9-records

Conversation

@BillWagner
Copy link
Member

@BillWagnerBillWagner commentedNov 7, 2025
edited by RexJaeschke
Loading

It is quite possible that some members will think that some (maybe a lot) of the text is "implementation detail," which should be discarded and (presumably) replaced with some minimal wording.

All commits from#983 have been squashed and added to this PR.

This PR / feature makes numerous changes to the grammar. We still need corresponding updates to the test and validation suite.

The following notes are carried over for additional work needed:

A. I put the new subclause "With expression" prior to "Arithmetic operators", which once the V8 features "Indices and Ranges" and "Pattern matching" have been merged, should immediately follow "Range operator" and "Switch expression." Make sure these are all in the correct place. 12.4.2 Operator precedence and associativity will also need to be revised accordingly.

B. New subclause §rec-class-prtmem Printing members mentions a methodSystem.Runtime.CompilerServices.RuntimeHelpers.EnsureSufficientExecutionStack(). It's quite possible that this is an implementation-specific detail, in which case, we'll need to find words to make it abstract, and possibly update the Portability annex accordingly.

Add support for record classesAdd files via uploadAdd support for record classesAdd support for record classesfix markupfix markdown formattingfix markdown formattingfix linkanother missed link
@BillWagnerBillWagner changed the titleFeature support for records[Version 9.0] Feature support for recordsNov 7, 2025
@RexJaeschkeRexJaeschke added this to theC# 9.0 milestoneNov 8, 2025

An awaiter’s implementation of the interface methods`INotifyCompletion.OnCompleted` and`ICriticalNotifyCompletion.UnsafeOnCompleted` should cause the delegate`r` to be invoked at most once. Otherwise, the behavior of the enclosing async function is undefined.

##§with-expressions With expressions
Copy link
Contributor

Choose a reason for hiding this comment

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

We need to add "with" as a new row to the table in the (earlier) section "Operator precedence and associativity." And as we have historically organized the sections in this clause in descending precedence order, we might need to move this new section up or down, accordingly.

Comment on lines +22 to +24
class_tag
: 'class'
| 'record'
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI: In V9,record meansrecord class but we can't say that explicitly. In V10, this is permitted and we'll replace these 2 rules with'record'? 'class'.


A*class_declaration* is a*type_declaration* ([§14.7](namespaces.md#147-type-declarations)) that declares a new class.

```ANTLR
Copy link
Contributor

@RexJaeschkeRexJaeschkeNov 8, 2025
edited
Loading

Choose a reason for hiding this comment

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

Heads up grammarians! As you will see below, I have a generous syntax for a class in which not all combinations are permitted, and those combinations are described in text as constraints. (For example, a record class can have adelimited_parameter_list while a non-record class cannot. And for a record class,class_modifier shall not bestatic.) Yes, we could try to break this up into separate rules for record classes and non-record classes to eliminate some (but maybe not all) of those constraints. However, there will be tweaks to this grammar in future versions; specifically:

  • V10 allowsrecord class as well asrecord.
  • V10 supportsrecord struct.
  • V12 allows a primary constructor (which usesdelimited_parameter_list) on non-record classes and structs.

which means that extra work done now to make the grammar rules more complete likely will be (at least partially) undone in future revs.


The method performs the following tasks:

1. Calls the method`System.Runtime.CompilerServices.RuntimeHelpers.EnsureSufficientExecutionStack()` if that method is present and the record class has printable members.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really want to expose this type in the spec?

Tweaks I made when comparing this PR with what I researched 2+ years ago.
@RexJaeschkeRexJaeschke added the Review: pendingProposal is available for review labelNov 8, 2025
@RexJaeschkeRexJaeschke added the type: featureThis issue describes a new feature labelNov 11, 2025
@Nigel-EcmaNigel-Ecma self-assigned thisNov 19, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@RexJaeschkeRexJaeschkeRexJaeschke left review comments

At least 1 approving review is required to merge this pull request.

Assignees

@Nigel-EcmaNigel-Ecma

Labels

Review: pendingProposal is available for reviewtype: featureThis issue describes a new feature

Projects

None yet

Milestone

C# 9.0

Development

Successfully merging this pull request may close these issues.

4 participants

@BillWagner@RexJaeschke@Nigel-Ecma

[8]ページ先頭

©2009-2025 Movatter.jp