Hacker News new | ask | show | jobs
by throwaway858 1490 days ago
C# has sum types
2 comments

C# does not have sum types.

It has "enumeration types" but their behaviour is exactly that of C's, with various additional conveniences but critically (and unlike Java for instance) no more type-safety.

Not without squinting really hard and making some OO monstrosity with internal impls of an outer abstract type it doesn’t. And that’s not really language support it’s banging your rocks together really hard trying to bend it into being ML.