Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions docs/fsharp/language-reference/anonymous-records.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,29 +181,6 @@ let data3 = struct {| data2 with Z = r2.X |}

Anonymous records have a number of characteristics that are essential to fully understanding how they can be used.

### Anonymous records are nominal

Anonymous records are [nominal types](https://en.wikipedia.org/wiki/Nominal_type_system). They are best thought of as named [record](records.md) types (which are also nominal) that do not require an up-front declaration.

Consider the following example with two anonymous record declarations:

```fsharp
let x = {| X = 1 |}
let y = {| Y = 1 |}
```

The `x` and `y` values have different types and are not compatible with one another. They are not equatable and they are not comparable. To illustrate this, consider a named record equivalent:

```fsharp
type X = { X: int }
type Y = { Y: int }

let x = { X = 1 }
let y = { Y = 1 }
```

There isn't anything inherently different about anonymous records when compared with their named record equivalents when concerning type equivalency or comparison.

### Anonymous records use structural equality and comparison

Like record types, anonymous records are structurally equatable and comparable. This is only true if all constituent types support equality and comparison, like with record types. To support equality or comparison, two anonymous records must have the same "shape".
Expand Down Expand Up @@ -255,7 +232,7 @@ Anonymous records have some restrictions in their usage. Some are inherent to th

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.
Copy link

Copilot AI Oct 16, 2025

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.

Copy link
Member

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.

2. Because of (1), there is no ability to have additional patterns in a pattern match expression, as each distinct pattern would imply a different anonymous record type.
3. Because of (2), any anonymous record pattern would be more verbose than the use of “dot” notation.

Expand Down
Loading