Hacker News new | ask | show | jobs
by aryonoco 26 days ago
C# finally has Sum types.

Not quite discriminated unions, but close. With an exhaustive checker with switch statements.

Now if only it made creating unique types easy, so I wouldn’t have to use a library like VOgen, the language would be nearly as good as F#

1 comments

Hey there. C# language designer here. Working on that here: https://github.com/dotnet/csharplang/tree/main/proposals/dis...

You can start reading through it starting at: https://github.com/dotnet/csharplang/blob/main/proposals/dis...

Definitely want to move to get this in asap :)

Merci Cyrus Jan

Makes me confident in C# to see the language in the hands of talented and clearly passionate designers like you.

As for your DU proposal, between Union types and enums, I think you know that anyone who has used TS or Rust or F# or OCaml will have a strong preference for the Union based syntax.

Good luck with the effort to get it added!