-
Notifications
You must be signed in to change notification settings - Fork 6k
Remove misleading nominal types section from F# anonymous records documentation #49288
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: BillWagner <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes the misleading "Anonymous records are nominal" subsection from the F# anonymous records documentation, as it incorrectly described the type system behavior of anonymous records. The documentation previously stated that anonymous records are nominal types, when they actually exhibit structural typing behavior—two anonymous record type aliases with identical structure are compatible, which is characteristic of structural typing.
Key changes:
- Removed the entire misleading subsection explaining nominality
- Updated the pattern matching limitation explanation to use more accurate terminology
Anonymous records do not support pattern matching, unlike named records. There are three reasons: | ||
|
||
1. A pattern would have to account for every field of an anonymous record, unlike named record types. This is because anonymous records do not support structural subtyping – they are nominal types. | ||
1. A pattern would have to account for every field of an anonymous record, unlike named record types. This is because anonymous records do not support structural subtyping – they require exact field matching. |
Copilot
AI
Oct 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a frontmatter key ai-usage: ai-assisted
to this file if AI was used to assist with these documentation changes, as per the .NET documentation guidelines.
Copilot generated this review using guidance from repository custom instructions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IEvangelist What's your thinking here? I think this change is below the bar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ready for final review.
Summary
Fixes #[issue_number]
This PR removes the misleading "Anonymous records are nominal" subsection from the F# anonymous records documentation, as recommended by @T-Gro in the issue discussion.
Problem
The documentation incorrectly stated that anonymous records are nominal types, when in fact they exhibit structural typing behavior. The provided examples in the section didn't actually prove nominality.
As demonstrated in the issue, anonymous records with identical structure are compatible:
This is characteristic of structural typing, not nominal typing. In contrast, named records with the same structure are incompatible because they truly are nominal types.
Changes
Removed the entire "Anonymous records are nominal" subsection - This section was misleading and added type-theory complexity without providing practical value to developers.
Updated the limitations section - Changed the explanation from "they are nominal types" to "they require exact field matching" to more accurately describe why anonymous records don't support structural subtyping.
The documentation now flows naturally into the "Anonymous records use structural equality and comparison" section, which correctly describes their behavior.
Validation
Original prompt
Fixes #46062
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Internal previews