this post was submitted on 18 Feb 2024
4 points (100.0% liked)

F Sharp

152 readers
4 users here now

founded 1 year ago
MODERATORS
top 4 comments
sorted by: hot top controversial new old
[–] [email protected] 2 points 8 months ago* (last edited 8 months ago) (2 children)

I've not seen any F# commenters here, but I have a question in case any lurk.

In short: does F# still have a major differentiating vision for the future? I know that most cool C# features were pioneered in F# first, but based on my ~2016 knowledge it has almost run out of features to steal.

For context, I used to love F#. It made C# feel ancient. But now C# has async, tuples, records, switch expressions, basic pattern matching, etc. It's all less elegant, but it's good enough that I can't justify using the less popular language anymore.

My concern is that F# has entered a state of half-success, where it has too many professional users to introduce risky new features, but it no longer has a USP strong enough to gain new ones. I'll be very happy if someone can explain why I'm wrong!

[–] [email protected] 3 points 8 months ago (1 children)

it has almost run out of features to steal

There is still one big feature, waiting to be added to C#. Discriminated unions. Come on Microsoft, it can't be that hard to implement

[–] [email protected] 1 points 8 months ago

That's true. You can kind of do it Scala style with an interfaces and some classes, but with two big drawbacks: no exhaustiveness checking, and no "object" syntax for defining singleton classes. They seem to be heading in that direction though.

[–] [email protected] 1 points 8 months ago* (last edited 8 months ago)

It's main strength doesn't lie in any isolated language features that C# might appropriate, but in the fact that it's a functional-first language. The language itself is designed from the ground up to encourage a programming style that is more logical, concise and modular than OOP. F# code has been proven time and time again to be far more compact and refactorable than C# code on average, and an order of magnitudes less error-prone.

F# is the kind of language that doesn't let you get away with sloppy coding, for better or worse. Not as efficient for quick prototyping as a language like Python, say, especially if you're way more familiar with the OOP paradigm, as most programmers today still are, but if you want reliability and maintainability with access to a vast library, there are few better options (only Scala comes close, I'd argue). This reliability and innate security is one of the reasons why it's relatively popular in the financial sector.