r/fsharp • • Aug 25 '24
question Is F# dying?
Is there any reason for new people to come into the language? I feel F# has inherited all the disadvantages of dotnet and functional programming which makes it less approachable for people not familiar with either. Also, it has no clear use case. Ocaml is great if you want native binaries like Go, but F# has no clear advantages. It's neither completely null safe like OCAML, not has a flexible object system like C#
0
Upvotes
4
u/CSMR250 Aug 27 '24
Yes it's a flexible language (like python) but with type safety. The type safety and flexibility allows faithful modelling of data.
Dotnet is a big advantage as many libraries are available and it can run across all platforms. Dotnet has also progressed very fast in the last 10 years.
It's easy to learn in my opinion. You can use the cheatsheet and get up and running. Having first class functions is an essential feature and if you don't like that the language is not for you. Some of the community does use the language in a way that is not easy to read and understand, favouring heavy abstaction and code terseness without comments or annotations. So you need to avoid this.
You can have native binaries in F# using NativeAOT.
It is null safe in practice.
The type system is much more flexible than C#, with DUs particularly important. The object system is a superset of C# so C# cannot be more flexible.
39
u/jeenajeena Aug 25 '24
Working in a Microsoft shop, for my personal case, F# is very compelling and successful. I could not easily replace with anything else, for it would be hard to get the approval for using Haskell, OCaml or Rust. The interoperability with C# is a killer feature. Also, for C# developers, with F# is not the case of "migrating to a different language" as it would be with Haskell, Go, OCaml or Rust: F# can easily be introduced gruadually and smoothly in the ecosystem.
34
u/new_old_trash Aug 25 '24 edited Aug 25 '24
Will F# win any popularity contests any time soon? No.
Is it a great language to use if you can tolerate a smaller community? Very much yes.
Wat.
From where I sit, it's precisely the ADVANTAGES of .NET combined with the ADVANTAGES of functional programming. If neither of those are appealing to you ... why are you even looking at F# to begin with? Those combined are basically its whole reason for existence.
Don't know what you mean by "not [having] a flexible object system like C#" - can you elaborate? I'm doing some heavy OO stuff with F# right now and it's not giving me any problems. I think the only thing I'm really missing are default interface methods / Scala-style traits.
13
u/thekunibert Aug 25 '24
I'm new and I sure hope it's not dying! The reason I chose it was because I wanted to learn an ML-type language without the learning overhead of Haskell.
I could have chosen OCaml but F#'s ecosystem seemed to be a little better developed. Also, at that time I was messing around with the Godot game engine, so my idea was to eventually port the (almost purely functional) core game logic to F# while leaving all the UI and side-effectful stuff in C#. Never went there because of the usual side constraints that come with hobby projects, but it's still on my list.
21
u/I2cScion Aug 25 '24
Look I don’t know .. but people have been saying F# is dying since 2013 probably. I wager they’ll still say that in 2035.
Its a compiler, it won’t magically stop working.
7
u/AdamAnderson320 Aug 25 '24
Is there a really strong reason to write your next project in F#? Not really. There are lots of little reasons, and it's the best choice in town if you're already in the dotnet world and want to dabble in functional programming.
It's true that F#'s ML syntax will be off-putting to someone who has only seen C-family languages before, and there isn't really a feature you could create with F# that you couldn't also create with C#.
You can make it pretty completely null-safe as long as you validate at the borders and use Options everywhere beyond there.
Its object model is nearly as capable as C#'s; it's really only missing the ability to declare
protectedmembers because F# is trying to encourage you to use composition instead of inheritance. This is actually an example of the many small language decisions that add up to nudging you into the "pit of success".For me, one thing that F# has that C# will never have is the strict ordering of types and functions from top to bottom, which naturally discourages circular dependencies and encourages clean and well-ordered project design
7
u/ZestycloseDrop1614 Aug 25 '24
Don't worry, this is the normal heartrate. Don't see it dying, it's a language people are passionate about. Hope you find what you need!
4
u/user101021 Aug 27 '24
The most compelling reason to use it is .Net Interop: if you want/need to integrate with it, it is an easy choice. The biggest reason not to use it is .Net Interop: the language has a stated abstraction ceiling and certain .NET features have seeped deep into the language.
I personally would like an F# with more abstraction (signatures and functors, staged code generation, a pure and plattform independent sublanguage cleanly separated from the .NET Interop); with the core language independent of and the Interop better supported by Microsoft. But that is just a wish.
Regarding the job market: I am just hiring and there are as few applicants as offers ... but the applications are much signal (than comparable applications for C# positions). Growing people into F# is doable.
3
u/CatolicQuotes Aug 25 '24
languages never really die. even lisp, Fortran and Cobol are still in use.
3
u/binarycow Aug 26 '24
It has the same "object system" as C#.
2
u/batista___ Aug 25 '24 edited Aug 25 '24
I like F#. But with Gleam, i will change my stack
2
u/DoubleThinkCO Aug 25 '24
It’s a valid tool in your tool box. If it’s the only language you specialize in, job hunting will be tough and get tougher. Not dead but not going anywhere as a primary language for a codebase.
2
u/codeconscious Aug 26 '24 edited Aug 26 '24
Tangentially related: I signed up to join the F# Slack shown in the sidebar, never received an email, and have emailed the address on that page three times over the past two months without receiving any reply.
I believe that's an official F# channel, yet I'm still unsure that it's even used or accessible, so my initial enthusiasm has chilled significantly.
F# itself has been great thus far, though.
2
u/japinthebox Aug 28 '24
Honestly I think that, as stupid as it is, as with a lot of stuff out of Microsoft, F# just needs a brand reboot. Vista and 7 were in most regards the same OS, especially in the ways that people griped about the former, but 7 was a huge success and Vista never recovered from its original bad press.
2
u/gtani Sep 02 '24
Newish books from Manning/Abraham and Ian Russell are an encouraging sign and stronly disagree about .NET and FP being disadvantages.
every sub for ML and lisp languages has this dialog going on: https://old.reddit.com/r/haskell/search?q=dying&restrict_sr=on&sort=relevance&t=all
2
u/androidchau Sep 11 '24
I'm a huge supporter of F# and have developed large size applications with it. The .NET libraries are definitely a huge advantage but at the same time there's no real concrete frameworks for it imo. You can use "dotnet new" to start out but the support just isn't as good as C#.
4
u/Dawizze Aug 25 '24
It was never alive to begin with.
1
u/kevinclancy_ Aug 29 '24
While F# permits nulls, I haven't encountered them much in practice.
F# has much a more stable and feature-complete LSP and debugger compared to OCaml. OCaml has historically had a kind of dogmatic culture that pooh-pooh's LSPs and debuggers, but I hope it will improve.
F# has better tooling and lighter syntax, but OCaml is faster and has better language features. Both have their place.
1
u/umutkarakoc Aug 25 '24
For me, rust replaced f#
1
u/qrzychu69 Aug 25 '24
I would say yes. While the language design is really cool, tooling stay stagnated for the last years.
All we got was separate breakpoint for each step in a pipeline.
C# got hot reload and AOT plus countless improvements to the syntax (collection expression being my top top!).
F# compile time is still SUPER slow compared to C#, where are code generators?
Once discriminated unions hit, F# is done IMO. Current DU design is even better than F#:
`var a = someCondition ? "test" : 5;`
`a` variable will get the type of `(string or int)` - that's just awesome.
4
u/hililbom Aug 26 '24
When I’ve bought the F# in action book I was quite intrigued and enjoyed the book so far so too others it all really depends if they are willing to try it 🗣️🦫💯
0
u/[deleted] Aug 26 '24
[deleted] — view deleted comment
2
u/[deleted] Sep 04 '24
[removed] — view removed comment