Yeah, I still don't understand why they don't just use enums and have to invent a special "union" keyword instead. C#'s enums are extremely underpowered to begin with and the syntax they designed here way more convoluted and uglier to say:
enum Pet {
Cat,
Dog,
Bird
}
var description = Pet switch
{
Dog d => d.Name,
Cat c => c.Name,
Bird b => b.Name,
_ => "no pet"
}
The other issue is they introduced `null` to pattern matching on their union example when the whole point of pattern matching is that you can pretty much mostly remove `null` from the language altogether with Result<T, E> available, as Rust has shown.