I used to see some excitement around .net core several years ago. I haven’t heard or seen much in the wild. Is anyone using .net on systems other than windows nowadays?
.NET (OK, C#) finally gets union types
21–30 of 300 posts
Re: .NET (OK, C#) finally gets union types
#22I used to see some excitement around .net core several years ago. I haven’t heard or seen much in the wild. Is anyone using .net on systems other than windows nowadays?
companies spend a lot on marketing, and it's not just ads.
Re: .NET (OK, C#) finally gets union types
#23I 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.
Re: .NET (OK, C#) finally gets union types
#24AFAICT, this means you won’t be able to define Either , which is definitely a thing you sometimes want to do.
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:…
Re: .NET (OK, C#) finally gets union types
#25Re: .NET (OK, C#) finally gets union types
#26I 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.
Unions are simpler than subclasses and more powerful than enums, so the use cases are plentiful. This should reduce the proliferation of verbose class hierarchies in C#. Algebraic data types (i.e. records and unions) can usually express domain models much more succinctly than traditional OO.
such as?
> This should reduce the proliferation of verbose class hierarchies in C#
So just as an alternative for class hierarchies? I mean good people already balance that by having a preference for composition.
Re: .NET (OK, C#) finally gets union types
#27I used to see some excitement around .net core several years ago. I haven’t heard or seen much in the wild. Is anyone using .net on systems other than windows nowadays?
All of them run in Linux servers.
Some of them were ported from PHP and Python to C#.
Plus LLMs thrive in strongly typed languages.
Which means C# will keep being very strong in enterprise too. Not only in games where it reigns a large chunk of the market share.
Re: .NET (OK, C#) finally gets union types
#28I 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.
A common use case for the sum type is to define a Result (or Either) type. Now, C# not having checked exceptions is not as much in need for one as Java is, but I could still imagine it being useful for stream like constructs.
Re: .NET (OK, C#) finally gets union types
#29F# leads the way and C# slowly catches up, as always. Yet for some reason, C# still gets all the mindshare.
Re: .NET (OK, C#) finally gets union types
#30I used to see some excitement around .net core several years ago. I haven’t heard or seen much in the wild. Is anyone using .net on systems other than windows nowadays?
There's not tons of noise being made because for the most part it all, Just Works and that's fairly boring. Perf, memory usage etc gets better every release. As an ecosystem, I'm pretty happy with it. I reach for other languages for smaller microservices.