C# will be a force to reckon with if/when discriminated unions finally land as a language feature.

I think people who last looked at C# 10 years ago or haven't adapted to new language features seriously don't know how good C# is these days.

Switch expressions with pattern matching are absolutely killer[0] for its terseness.

Also, it is possible to use OneOf[1] and Dunet[2] to get access to DU

[0] https://timdeschryver.dev/blog/pattern-matching-examples-in-...

[1] https://github.com/mcintyre321/OneOf

[2] https://github.com/domn1995/dunet

I write C# and rust fulltime. Native discriminated unions (and their integration throughout the ecosystem) are often the deciding factor when choosing rust over C#.

Very hard to imagine teams cross shopping C# and Rust and DU's being the deciding factor. The tool chains, workflows, and use cases are just so different, IMO. What heuristics were your team using to decide between the two?

This surprises me.

If you want the .NET ecosystem and GC conveniences, there is already F#. If you want no GC and RAII-style control, then you would already pick Rust.

> OneOf

I do like/respect C# but come on now. I know they're fixing it but the rest of the language was designed the same way and thus still has this vestigial layer of OOP-hubris

It's up to each team to decide how they want to write their code. TypeScript is the same with JS having a "vestigial" `class` (you can argue that "it's not the same", but nevertheless, it is possible to write OOP style code in JS/TS and in fact, is the norm in many packages like Nest.js).

The language is a tool; teams decide how to use the tool.

For me, it will be if they ever get checked errors of some sort. I don’t want to use a language with unchecked exceptions flying about everywhere. This isn't saying I want checked exceptions either, but I think if they get proper unions and then have some sort of error union type it would go a long way.

You can get an error union now: https://github.com/amantinband/error-or

The issue is the ecosystem and standard library. They still will be throwing unchecked exceptions everywhere