# C# Language Design Meeting for June 25th, 2025

## Agenda

- [Unions](#unions)
    - [Stand-alone issues](#stand-alone-issues)
    - [Mutually exclusive issues](#mutually-exclusive-issues)

## Quote of the Day

- "Runtime typo unions"

## Discussion

### Unions

Champion issue(s):
* Closed enums: https://github.com/dotnet/csharplang/issues/9011
* Nominal type unions: https://github.com/dotnet/csharplang/issues/9411
Documents:
* https://github.com/dotnet/csharplang/blob/0809d6632e3f8d15d3ead205bfc83bd35816aa8f/meetings/working-groups/discriminated-unions/Trade%20Off%20Matrix.md

Today, we took a dive into unions. The unions working group has come back with a set of discrete proposals to try and help narrow the
potential options for where we should invest in unions in C#. There are 5 discrete proposals here, 3 of which stand on their own, and
then 2 of which are likely mutually exclusive. We did not dig into syntax or precise semantics for any of these today.

#### Stand-alone issues

* https://github.com/dotnet/csharplang/blob/0809d6632e3f8d15d3ead205bfc83bd35816aa8f/meetings/working-groups/discriminated-unions/Closed%20Enums.md
* https://github.com/dotnet/csharplang/blob/0809d6632e3f8d15d3ead205bfc83bd35816aa8f/meetings/working-groups/discriminated-unions/Closed%20Hierarchies.md
* https://github.com/dotnet/csharplang/blob/0809d6632e3f8d15d3ead205bfc83bd35816aa8f/meetings/working-groups/discriminated-unions/Case%20Classes.md

These are closed enums, closed hierarchies, and case classes. We feel that these are fairly orthogonal to the type union proposals
below, and make sense on their own. Closed enums and hierarchies are mainly about getting users the ability to be exhaustive in such
a way that they will get explicit source-breaking changes when new cases are added, and case classes are then a syntax sugar to allow
declaring such type hierarchies in a more ergonomic fashion. We strongly believe that these should be a priority for the LDM in the
near term.

#### Mutually exclusive issues

* https://github.com/dotnet/csharplang/blob/0809d6632e3f8d15d3ead205bfc83bd35816aa8f/meetings/working-groups/discriminated-unions/Runtime%20Type%20Unions.md
* https://github.com/dotnet/csharplang/blob/0809d6632e3f8d15d3ead205bfc83bd35816aa8f/meetings/working-groups/discriminated-unions/Nominal%20Type%20Unions.md

The other two proposals are likely mutually exclusive. We're not certain that C# has room for two different sets of semantics here.
There is an elegance in the nominal approach in the way that it does not try to pretend about the cases, and that there is no `is-a`
relationship that would either leak through or need runtime support for. The timelines for it are also shorter, as runtime support
would take some non-trivial amount of time. Given these, we lean towards nominal type unions here.

#### Conclusion

We will continue working on 4/5 of these proposals: closed enums, closed hierarchies, case classes, and nominal union types.
