Remix.run Logo
vips7L 2 days ago

Java has first class sum types, pattern matching, and compiler exhaustion on types. It's probably far more expressive than C# currently until they get union types.

mrsmrtss 2 days ago | parent | next [-]

Well, C# has more powerful pattern matching, only compiler exhaustiveness on types is missing today. In Java, sum types (sealed interfaces/classes) require all members to have the same parent, so they can be used only in very narrow cases.

vips7L 2 days ago | parent [-]

As opposed to C# that doesn't have any form of sum types?

mrsmrtss 2 days ago | parent [-]

C# will have more advanced sum types this year, it's currently in preview.

drzaiusx11 2 days ago | parent | prev [-]

Their sum types aren't particularly useful since they can never be used to implement union types which I believe c# has plans for following their sum types already in preview. So I guess similarly neck and neck.