Live data from Hacker News

Official proposal for Type Unions in C#

github.com

101–110 of 315 posts

Re: Official proposal for Type Unions in C#

#101

Earlier quoted context omitted.

A very common modern setup is PostgreSQL, C#/.NET, Linux & using JetBrains Rider for the IDE You just described the startup I'm at. All devs are on Arm64 MacBooks and we deploy to Arm64 AWS T4g Linux instances. I'm all VS Code, others are primarily Rider. .NET is a highly underrated platform for backend; it always puzzles me when teams think about moving from TypeScript to Rust or Go instead of C# because it seems a…

I'm itching to try and deep dive into go as a C# dev. I'm getting sick of enterprise C#, even if it is .NET8 I guess the grass is always greener somewhere

Maybe startup C# feels very different; it feels much more like TypeScript and I more or less write C# like I would write TypeScript.

Re: Official proposal for Type Unions in C#

#102

Earlier quoted context omitted.

Nah, people continue to pick Java or Go when they want to build their enterprise systems if they're not already married to Microsoft. There's not a single widely distributed infra application in C# out there. When people want to build stuff like kafkas, kubernetes, consuls, they still go to Java/Go/C++.

> There's not a single widely distributed infra application in C# out there. Azure has entered the chat. Microsoft Orleans has entered the chat. ASP .NET Core has entered the chat. Ever played Halo online? Used StackOverflow? (very likely) Visited any website on Azure? (most likely) Microsoft Orleans (Virtual Actor framework) powers the Halo server infrastructure since at least 2011 if not sooner, which arguably the…

I'll add Bitwarden and Jellyfin to the list of cross platform apps written in C# that are widely popular.

Re: Official proposal for Type Unions in C#

#103

Earlier quoted context omitted.

How widely understood and appreciated were algebraic data types at the time Cfront was first floated as the precursor to C++? To what degree had they shown up in mainstream languages?

Well if you want to compare to why C++ has multiple inheritance, you need to first explain which mainstream languages in the mid-1980s had multiple inheritance so we can contrast. Like algebraic data types, multiple inheritance wasn't novel, but what were the big famous languages from that time which showed this was a must have for Bjarne's language?

That's not the comparison I'm making. It's possible for a proposed language to add something despite not being popular at the time, but that's not the default. I'm suggesting that if ADTs were not already popular at the time, it would be the unsurprising default for them to not be in a new language. In today's language landscape, by contrast, it would be surprising and disappointing for a new language to not have either ADTs or a specific alternative they propose for solving the same problem.

Re: Official proposal for Type Unions in C#

#104

Earlier quoted context omitted.

C# is great, likely the best mainstream programming language nowadays, but its in the hands of microsoft and microsoft didn't really care much about building a community or getting it to work natively in other OSes/toolchains. Its a shame, they even had a second change when Oracle bought sun and no one knew what was going to happen with Java, but fumbled that as well.

> but its in the hands of microsoft and microsoft didn't really care much about building a community or getting it to work natively in other OSes/toolchains. That statement was true - until 2016. Times change, Microsoft changed.

A lot of devs are still living in the 2010s

Re: Official proposal for Type Unions in C#

#105
It’s ironic when things like this get added back into C-styled languages that were intended to be easier than their predecessors.

Seems more confusing than useful. Wish they’d stop adding onto this ever expanding language.

It’s like these people get bored of plain old functions and objects, read an academic paper and go “i think I’ll add that next”.

Re: Official proposal for Type Unions in C#

#106

Earlier quoted context omitted.

Nah, people continue to pick Java or Go when they want to build their enterprise systems if they're not already married to Microsoft. There's not a single widely distributed infra application in C# out there. When people want to build stuff like kafkas, kubernetes, consuls, they still go to Java/Go/C++.

> There's not a single widely distributed infra application in C# out there. Azure has entered the chat. Microsoft Orleans has entered the chat. ASP .NET Core has entered the chat. Ever played Halo online? Used StackOverflow? (very likely) Visited any website on Azure? (most likely) Microsoft Orleans (Virtual Actor framework) powers the Halo server infrastructure since at least 2011 if not sooner, which arguably the…

Bing is well known for being Microsoft's 'dogfood' candidate for new versions of .NET.

https://visualstudiomagazine.com/articles/2018/08/22/bing-ne...

https://www.bing.com/version

Re: Official proposal for Type Unions in C#

#107
post #14

Earlier quoted context omitted.

I do like Scala, and I haven't touched Scala3, but I've found it pretty unwieldy for actual use. It feels like I'm constantly fighting with the type system in a way that ends up being annoying an unpleasant. To be clear, it's not like I'm new to functional languages and their type systems, I've been doing Haskell for forever, and I did F# for a multiple years, but Scala has never really clicked for me. Personally, fo…

> I definitely recommend giving F# a try. I think it's an extremely underrated language. Do you have any recommendations for people who do not have C#/.NET experience who want to rip their toes in F#? The last time I tried the language I bumped my head on the .NET parts. :/

While a bit dated, F# For Fun and Profit is a great learning resource:

https://fsharpforfunandprofit.com/

Re: Official proposal for Type Unions in C#

#108
post #65

Earlier quoted context omitted.

Out of curiosity, what confused you about the .NET stuff? I didn't have any .NET experience going into F# either [1] and I didn't find it too hard to pick up the .NET stuff. For the most part I didn't need most of the built in .NET libraries; the F# stuff was fine, but the ones I ended up using a lot were the threadsafe libraries for when I needed mutation across threads. ConcurrentDictionary was one I used an awful…

I was working on a Linux laptop and the installation process wasn't immediately clear. Some of the frameworks I looked at didn't target the most recent .NET version so I had to install multiple versions. Once I had it installed, I had compilation failures with a project that was built on Windows. The team that ran it wasn't sure what was happening. Also, having the documentation split between the F# parts on one site…

Hopefully this website can get you further with the installation. There will probably still be issues between Windows and Linux specific tutorials, depending on what you are trying to do.

https://fsharp.org/use/linux/

Re: Official proposal for Type Unions in C#

#109
post #89

Earlier quoted context omitted.

> I definitely recommend giving F# a try. I think it's an extremely underrated language. Do you have any recommendations for people who do not have C#/.NET experience who want to rip their toes in F#? The last time I tried the language I bumped my head on the .NET parts. :/

It is a dream learning guest languages, while trying to avoid the platform, one really needs to understand UNIX, Web, .NET, Java, Erlang... for using whatever alternative leaky abstractions are provided on top of them. In F#'s case, there are plenty of good books, and then it is really needed to learn the platform. Some well known ones => Stylish F#, F# in Action, Domain Modeling Made Functional

Thank you for the recommendations. I still find using a physical book easier to learn from, even if they do tend to be out of date faster than online resources. I feel as though F# doesn't move as fast as other parts of the .NET ecosystem, and in particular the Domain Modeling Made Functional seems like it will be relevant for years to come.

Re: Official proposal for Type Unions in C#

#110
post #3

Huh, I did F# for years with discriminated unions, and I guess I just assumed C# would have had them by now. I know not everyone likes them, but for typed languages I find it extremely hard to go back to languages without ADTs of some kind. I do Java for my current job, and Java is generally fine enough, but it's a little annoying when I have to do whacky workarounds with wrapper classes to get something that would b…

As of 2020 (when I stopped using F# and .Net in general), the CLR only had inheritance and F#'s enums were actually implemented using inheritance. Eg Some and None were derived classes of Option class. You would see it if you inspected an F# assembly in a decompiler. I don't know if it's still the same today. This C# proposal has anonymous enums using `A or B` syntax which would be hard to make work as sugar over inheritance, so I guess the CLR would support enums first-class for this to work (if it doesn't already).
Post reply on HN