F# leads the way and C# slowly catches up, as always. Yet for some reason, C# still gets all the mindshare.
What types of problems are better solved in F# than C#? Is having a combination of F# and C# in a single codebase possible? Is it recommended?
.NET (OK, C#) finally gets union types
161–170 of 300 posts
Re: .NET (OK, C#) finally gets union types
#162Earlier quoted context omitted.
Do you think by now C# has left Java behind in features and performance?
more than 10 years ago, yes
Re: .NET (OK, C#) finally gets union types
#163Earlier quoted context omitted.
I guess C# is more strongly-typed than Haskell then... /s
String literal typing appears to be a common feature of type systems bolted onto dynamic languages: # Python MyStringBool = Literal("Yes") | Literal("No") // TypeScript type MyStringBool = "Yes" | "No" I assume it exists to compensate for the previous lack of typing, and consequent likelihood of ersatz typing via strings. It would seem pretty unnecessary in Haskell, where you can just define whatever types you want w…
Re: .NET (OK, C#) finally gets union types
#164Earlier quoted context omitted.
I see this reason a lot but what are some actual examples of what is lacking in the .NET ecosystem vs. Java?
Dev tools. The debugger is something for example that Microsoft ostensibly keeps to their own products, and how they totally slaughtered omnisharp. It killed my daily csharp vscode driver couple of years ago, only now catching back up somewhat, but still unusable for bigger solutions. That move made me gravitate towards vscodium, and avoiding csharp where possible. Microsoft's move only recently got more understandab…
Re: .NET (OK, C#) finally gets union types
#165Earlier quoted context omitted.
String literal typing appears to be a common feature of type systems bolted onto dynamic languages: # Python MyStringBool = Literal("Yes") | Literal("No") // TypeScript type MyStringBool = "Yes" | "No" I assume it exists to compensate for the previous lack of typing, and consequent likelihood of ersatz typing via strings. It would seem pretty unnecessary in Haskell, where you can just define whatever types you want w…
Thank you for the lecture but I didn’t mean that. I meant `Either String String` is possible in Haskell and not in C# because… C# is strongly-typed.
Re: .NET (OK, C#) finally gets union types
#166Earlier quoted context omitted.
See my edit above. There is the C terminology, and the TypeScript et al terminology, and it's the same "untagged" terminology for two different things. In any case, both these kinds of "untagged" unions are different from tagged/discriminated unions. So just calling them "unions" is ambiguous at best and confusing at worst.
But no one is actually confused. You yourself understand what the author meant, from your comments. Everyone here understands what he meant. It's neither ambiguous nor confusing to use the word union in CS. The only person who's making it so is you, by introducing semi-unrelated concepts from set theory that happen to have the same name as the established CS concept. Why stop there? Maybe the author meant the Union,…
Wrong, see this comment: https://news.ycombinator.com/item?id=48251896
Clearly he thought that it's the same kind of union as in TypeScript and that in C# just the syntax is weird. Which is not the case. Some others who are not commenting are probably also not aware of the two kinds of union types (or three, counting C separately).
> It's neither ambiguous nor confusing to use the word union in CS.
Well, we disagree.
Re: .NET (OK, C#) finally gets union types
#167Earlier quoted context omitted.
more than 10 years ago, yes
More like 25. C# 1.0 already had capabilities Java developers are still dreaming of, like structs / value types, properties and operator overloading. C# 2.0 in 2005 introduced generics, implemented far more competently than Java ever did.
Re: .NET (OK, C#) finally gets union types
#168Re: .NET (OK, C#) finally gets union types
#169Earlier quoted context omitted.
String literal typing appears to be a common feature of type systems bolted onto dynamic languages: # Python MyStringBool = Literal("Yes") | Literal("No") // TypeScript type MyStringBool = "Yes" | "No" I assume it exists to compensate for the previous lack of typing, and consequent likelihood of ersatz typing via strings. It would seem pretty unnecessary in Haskell, where you can just define whatever types you want w…
Thank you for the lecture but I didn’t mean that. I meant `Either String String` is possible in Haskell and not in C# because… C# is strongly-typed.
That Haskell snippet is just syntax sugar for Left(string) | Right(string), which is trivial in any language with unions.
Not clear why it would be an improvement over just naming the alternatives something meaningful, but if you're wedded to Left and Right, go for it.
Re: .NET (OK, C#) finally gets union types
#170Earlier quoted context omitted.
Not OP here - but for me it’s the open source ecosystem. Java just wins in terms of scope, scale, and stability. I love C# the language, but the ecosystem is a ghetto.
I see this reason a lot but what are some actual examples of what is lacking in the .NET ecosystem vs. Java?
It is not, Java is like C, C++, JavaScript and co.
There are many implementations, the language and runtime are evolving by industry partners, you get bare metal implementations with real time GC like PTC and Aicas (doing AOT for decades), JIT caches, cloud based JIT compilers (OpenJ9 and Azul), pauseless GC, an LLVM like compiler development framework (Graal),....
There are industry standards like Microprofile and Jakarta EE, which several vendors base their frameworks and application servers on.
And a mobile phone platform, which while isn't proper Java compliant, has enough pieces into it that makes it easier to integrate Java code and libraries, than using Xamarin.
Microsoft actually bothered with ECMA during the early days, however it hasn't been updated since C# 7.3, .NET Framework 4.8.