Live data from Hacker News

.NET (OK, C#) finally gets union types

andrewlock.net

91–100 of 300 posts

Re: .NET (OK, C#) finally gets union types

#91
post #55

Earlier quoted context omitted.

Someone I know who works with .net says that there is still no replacement for full Visual Studio for development, which is Windows only.

Rider is the replacement, unless they are doing really specific (like WinUI2/UWP)

VS Code is also manageable. Or the CLI tools, if that's your thing.

Rider is definitely the most equivalent to full Visual Studio though.

Re: .NET (OK, C#) finally gets union types

#93

Earlier quoted context omitted.

Haskell, OCaml, Erlang lead the way and Rust, Zig and Go get all the mindshare. I feel like its a common pattern for more experimental languages to pioneer features and other languages to copy the features and bring them to a C style syntax that the majority of devs are familiar with.

Being first isn't necessarily good if you get it wrong, though. Laziness by default and Hindley-Milner type inference seem like mistakes that simply aren't going to get cleaned up. Other languages make their own mistakes too.

What's wrong with Hindley-Milner?

Re: .NET (OK, C#) finally gets union types

#94
post #74

Earlier quoted context omitted.

> Avalonia is underwhelming How? Can you elaborate?

Not OP, but I've found Avalonia to be pretty much a direct replacement for WinForms. I mean that both as a compliment and a deserved insult. It's not the WinForms we wanted, but it is the one we deserve. More seriously, it has all the strengths and weaknesses of WinForms and feels about exactly as unfinished and rough as WinForms. I still have to implement custom widgets that i would have expected to be included out…

I'm truly surprised that it feels that underdeveloped. They market Avalonia as a direct replacement for WPF too. So, I'd expect it at least match WPF to be fair.

Re: .NET (OK, C#) finally gets union types

#95
post #23

I mean yes, but also: uh-oh. I'm looking forward to reading some code that is even more confusing than the code I'm already reading. Not entirely convinced that I see the usecase that makes up for the potential madness.

Discriminated union types are a really fundamental building block of a type system. It's a sad state of matters that many mainstream languages don't have them.

> Discriminated union types are a really fundamental building block of a type system. It's a sad state of matters that many mainstream languages don't have them.

"Non-discriminated" unions (i.e. untagged unions) are even less supported. TypeScript seems to be the only really popular language that has them.

Re: .NET (OK, C#) finally gets union types

#98
post #94

Earlier quoted context omitted.

Not OP, but I've found Avalonia to be pretty much a direct replacement for WinForms. I mean that both as a compliment and a deserved insult. It's not the WinForms we wanted, but it is the one we deserve. More seriously, it has all the strengths and weaknesses of WinForms and feels about exactly as unfinished and rough as WinForms. I still have to implement custom widgets that i would have expected to be included out…

I'm truly surprised that it feels that underdeveloped. They market Avalonia as a direct replacement for WPF too. So, I'd expect it at least match WPF to be fair.

I would argue quite fervently that WinForms is more than a match for WPF. The only thing worse than WPF is UWP. We don't talk about UWP.

Re: .NET (OK, C#) finally gets union types

#100

Earlier quoted context omitted.

C# is strongly-typed, not stringly-typed. The point of the union is to list possible outcomes as defined through their respective types. The idiomatic way to do this would be to parse, don't validate [1] each string into a relevant type with a record or record struct. If you just wanted to return two results of the same type, you'd wrap them in a named tuple or a record that represented the actual meaning. [1] https:…

I guess C# is more strongly-typed than Haskell then... /s

You cant have a `type Foo = String | Strimg` in Haskell either.
Post reply on HN