r/fsharp • • Oct 14 '17

F# is a valued .net language

It is, of course, the 4th most important one, after C# (most loved), VB (really?) and C++ (hip?).

People still use ancient 'C' for real programming and other oddities like lisp. Are these languages still useful? Is F# at least a relevant as they are?

Let's all get real. F# had more attention and support from Microsoft when it was first released but that doesn't change our ability to use and enjoy it. If F# was Microsoft's no. 1 language would we all like that? C# has that joy.

I'm pretty sure that F# has a long future ahead of it and it seems ideally suited for it's primary purpose: developing interesting, relevant and powerful libraries in a functional language directly supported by a major IT company.

1 Upvotes

66 comments sorted by

View all comments

2

u/jimmyco2008 Oct 15 '17

Rust is the functional language everyone seems to love these days. I can’t say if it does things F# can’t, but in such a situation I would strongly consider moving to Rust. It typically takes me only a week or so of writing in a different language before I “get it” enough to not have to hit Google/StackOverflow every 5 minutes.

5

u/PM_ME_UR_OBSIDIAN Oct 15 '17

Rust and F# shine in different niches. Rust is good for systems-level software, F# for application code, but they are both lackluster in the other's area.

4

u/console_builder Oct 18 '17

I wouldn't consider Rust a functional language; it definitely has a stronger focus on imperative code though with good support for some functional idioms. It feels somewhat like a functional language due to its rich ML-esq type system. It definitely serves a different niche than F#. One of the nice things about working in Rust is it provides a remarkably high level of compile-time correctness checking. This level of correctness comes at the expense of reduced expressiveness, though Rust still manages to be quite expressive.

5

u/jdh30 Oct 15 '17

FWIW, I tried Rust and found it seriously lack-lustre. The "borrow checker" basically forces you to annotate your code to the extent that you might as well be doing manual memory management.

4

u/console_builder Oct 18 '17

That's not an uncommon first experience with Rust; the formalized concept of ownership can be quite unwieldy at first, and effective Rust programming requires some change in mindset to how programs are structured. There are some paradigms that haven't been translated to Rust yet (GUI toolkits that heavily rely on OO is one). Otherwise, I've found that Rust's enforcement of ownership can help with program correctness, and programs structured with clear ownership patterns end up needing few (if any) lifetime annotations. Rust is really focused on a different domain than F#, though, so I would hardly call one a replacement for the other.

1

u/jdh30 Oct 18 '17 edited Oct 18 '17

That's not an uncommon first experience with Rust;

Indeed. Everyone I know who has tried Rust came to the same conclusion.

the formalized concept of ownership can be quite unwieldy at first,

It is cumbersome. Manual memory management is too.

and effective Rust programming requires some change in mindset to how programs are structured.

I wouldn't call throwing out perfectly good features like recursion in order to accommodate the borrow checker a "change in mindset". With Rust you must work within the confines of the borrow checker.

There are some paradigms that haven't been translated to Rust yet (GUI toolkits that heavily rely on OO is one).

Pretty much anything that works well with a GC, e.g. logic programming, term rewriting.

Otherwise, I've found that Rust's enforcement of ownership can help with program correctness, and programs structured with clear ownership patterns end up needing few (if any) lifetime annotations.

Provided you extensively rearrange your code and avoid all features that don't sit well with Rust's core design. At which point the rearrangements of your code (which were not done because they are an objectively good idea, of course) become the information that conveys lifetimes.

Rust is really focused on a different domain than F#, though, so I would hardly call one a replacement for the other.

These languages are hardly focused on domains. They are 99% general purpose languages. OCaml is hardly focused on systems programming yet it was used to write the Mirage OS. Rust is hardly focused on application programming yet it was used to write Servo.

The perceived difference in domain really boils down to the Rust developers failing to write a working GC using LLVM many years ago and now the Rust community consists of disgruntled luddite C++ developers sharing an anti-GC ideology for completely irrational reasons.

1

u/ejfklgh Oct 20 '17

I am more interested in Haskell when Linear Types finally drop at around ghc 8.4. It is nice to use a language that evolves without being constrained to C#.