Back to Csharplang

C# Language Design Meeting for June 25th, 2025

meetings/2025/LDM-2025-06-25.md

latest2.9 KB
Original Source

C# Language Design Meeting for June 25th, 2025

Agenda

Quote of the Day

  • "Runtime typo unions"

Discussion

Unions

Champion issue(s):

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

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

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.