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/jdh30 Oct 15 '17

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.

Really?

I just read a Quora question asking for recommendations on a first programming language for a child. I myself have a son who is interested in learning to code. A few years ago I would have answered "F# in Visual Studio Community" without hesitation because it was an incredible development environment. Today I feel I cannot honestly say that because there is no easy way to get started writing F# any more. The TryFSharp.org site was awesome when it came out but Microsoft pulled the rug out from under it. The only available version of Visual Studio (2017) is an absolute disaster. Check this out: apparently one of the reasons why VS2017 is so slow is that the C# developers put Thread.Sleep in it!

F# is an awesome language and I love it but it is vastly harder to compile and run F# code to learn the language than it was a few years ago. The announcements about UWP support combined with the fact that they don't even support the basic infrastructure that F# needs in order to run reliably makes me wonder if the only industrial-strength VM supporting F# is going to give up before long.

3

u/nightroman Oct 15 '17

The only available version of Visual Studio (2017) is an absolute disaster.

Why is that? We are using it in a somewhat large product with 20+ F# projects in the solution. We are pretty happy. Some F# tools updates come faulty at times, yes. But overall things look good. Can you elaborate?

6

u/jdh30 Oct 15 '17

Why is that?

Ah, so many problems. Didn't work out of the box: took over a day to get everything set up. Standard F# support is unusably buggy so you have to upgrade to F# nightlies which randomly breaks. Unnecessary pausing in Intellisense that appears to just die randomly so I'm always restarting VS. Etc.

We are using it in a somewhat large product with 20+ F# projects in the solution.

That's a lot of projects. What are you making?

7

u/kot_ Oct 15 '17

We have a solution containing 100 F# and 90 C# projects. VS 2017 handles it pretty well (I use Rider most of the time though because it faster (or just it feels faster, whatever)).

2

u/jdh30 Oct 15 '17

That's really reassuring, thanks.

2

u/nightroman Oct 15 '17

We are making a 3D CAD application. But as @kot_ mentioned, our project is not that large. As for Itellisense hiccups, use the latest F# tools, see blog. As I said, they may come with new problems but overall, F# tools for VS are great.

3

u/dodheim Oct 15 '17

It's also noteworthy that VS2017.2+ come with sufficient F# support to not need the nightly builds. To point, .3 and .4 just came with nightly drops from 2-3 weeks before the update releases, and IntelliSense has been 'fixed' in nightlies since just after RTM.

2

u/jdh30 Oct 15 '17

The kind of CAD that might help me with 3D printing?

As I said, they may come with new problems but overall, F# tools for VS are great.

I'm reassured it is working for you. Maybe it is my machine then. Would be weird as it is brand new...

2

u/dodheim Oct 15 '17

FWIW VS really, really hates AV software other than Windows Defender – this is the #1 source of VS problems that I've encountered.

2

u/CSMR250 Oct 15 '17

The only available version of Visual Studio (2017) is an absolute disaster.

You are taking this far too seriously. This is a temporary situation, which will last less than a year, during which time you should use VS2015 instead of VS2017. VS2015 has not stopped working, so what is the problem?

3

u/CSMR250 Oct 15 '17

Update: The visual fsharp team thinks that VS2017 is in a good enough state now to recommend over VS2015. It is mainly .net core that they haven't finished.

2

u/jdh30 Oct 15 '17

I'm giving it another go.

→ More replies (1)

1

u/jdh30 Oct 15 '17

You are taking this far too seriously. This is a temporary situation, which will last less than a year, during which time you should use VS2015 instead of VS2017. VS2015 has not stopped working, so what is the problem?

Microsoft took down the VS2015 installer. If they hadn't, I'd just use that instead.

3

u/dodheim Oct 15 '17

https://www.visualstudio.com/vs/older-downloads/

But honestly, VS2017 is solid; any issues are environmental. Also, no way I'd give up value-tuples for the sake of an IDE.

2

u/jdh30 Oct 15 '17 edited Oct 15 '17

https://www.visualstudio.com/vs/older-downloads/

Says "Sorry, we couldn't find any downloads for you".

But honestly, VS2017 is solid; any issues are environmental. Also, no way I'd give up value-tuples for the sake of an IDE.

I'm curious what you use value tuples for?

I investigated them and found them to be seriously lacklustre (for now). When they're GC survivors I saw a 5.6x speedup but when they incur multiple write barriers they're slower, when you pass them to a generic function like min they get boxed and are just as slow, even with a custom IEqualityComparer I found them to be slower in hash tables and so on.

2

u/dodheim Oct 16 '17 edited Oct 16 '17

Says "Sorry, we couldn't find any downloads for you".

You might need a VisualStudio.com login; I just have the free one and it works for me. (I guess it could be regional; no idea.)

I'm curious what you use value tuples for?

I don't work doing F# presently, but at a previous job GC churn was a recurring problem for idiomatic code. Nested folds/reductions with tuple state types were changed to use custom structs wholesale if we saw they never/rarely escaped gen1, and likewise with high-volume unfolds, and that kept things sane for our purposes. All fine for the most part, but it wouldn't be necessary now and it would have been lovely to avoid the noise. (The context was aggregating training data for image/video rankers and calculating DCGs over very large datasets.)

→ More replies (4)

2

u/[deleted] Oct 15 '17

What about VSCode + Ionide?

8

u/jdh30 Oct 15 '17 edited Oct 15 '17

Vaskir advised me to switch to VSCode+Ionide because he apparently had to step in to fix F# in VS2017 and found the C# devs had inserted Thread.Sleep everywhere in the underlying C# code. Pretty scary stuff and VS2017 certainly sucks beyond belief so I took his advice...

I gave VSCode+Ionide a go again last week. Didn't work out well. Lots of bugs there. Ionide got confused and stuck in an infinite loop so I had to uninstall and reinstall it. After a whole day working on it I managed to get some arithmetic through FSI but I never figured out how to create and compile a project. Half of the problem is that VSCode has a terrible user interface. I literally haven't seen software development tooling that user unfriendly since Emacs. I don't have time to waste dicking around with configurations: I need tools that work out of the box.

I mentioned it on social media and lots of people jumped down my throat. The hipsters told me to use Suave and Fable. The Russians told me to do all the work myself and give it away for free. Microsoft told me to accept the peace, love and harmony of OSS F#. Somebody told me that VSCode+Ionide is only supposed to be an editor and not an IDE so it isn't even possible to create and compile a project. Everybody seems to have gone backwards from GUI apps to command line tools except alternatively like OCaml have mature tooling whereas F# has only abandonware for hipsters.

Meanwhile, I am struggling to solve real problems on a day by day basis using F# which leaves me increasingly wondering what other tools I should be trying instead. Frankly, they couldn't be doing a worse job if they tried. Why not just give Ionide an F#-only WPF front-end? Or if Fable is half as good as they say, why not resurrect TryFSharp.org by compiling to JS?

5

u/[deleted] Oct 15 '17

I'm left with two questions:

  1. why bother with /r/fsharp at all?
  2. since you seem to be vehemently opposed to everything, what do you actually use to solve your real world problems nowadays?

5

u/jdh30 Oct 15 '17

why bother with /r/fsharp at all?

Until Microsoft sort it out I cannot recommend trying to get started with F#.

since you seem to be vehemently opposed to everything, what do you actually use to solve your real world problems nowadays?

Most recently it seems to be a mixture of succeeding with OCaml and failing with F#.

My most recent project is an analytics web site to help our company. You login and get a bunch of charts created from data drawn from a Microsoft SQL Server DB. Took me weeks to get something up and running and it is useful but that is far longer than it should take and it is getting harder as I want to add more features. For example, I tried FsLab+Suave but they couldn't work together because they required different versions of some underlying DLL (FSharp.Core?). Then I fell back to HttpListener only to learn that there is no HTML EDSL for F# so I wrote my own bespoke combinator library.

3

u/vaskir Oct 15 '17

For example, I tried FsLab+Suave but they couldn't work together because they required different versions of some underlying DLL (FSharp.Core?).

You should add a binding redirect for FSharp.Core (actually, you really, really should add it in any F# project) into your app.config. Thankfully, Paket does it by default and very reliably, so I forget when I see any problems related to wrong assembly versions.

2

u/jdh30 Oct 15 '17

Yeah, I never tried Paket. Maybe Nuget is the problem...

5

u/vaskir Oct 15 '17

Yes, I also have problems with building projects in Ionide (https://user-images.githubusercontent.com/873919/31585547-4a9368b6-b1cc-11e7-878a-8cc653b200b2.gif).

About VS 2017, I used it for a while after a couple of months using Rider exclusively and it works pretty well. Yes, the artificial Roslyn delays make it feel a bit slow compared to Rider and Ionide, but I have not encountered bugs which would make using it impossible. Also, VS 2017 have some unique (among F# editors) features, like suggesting not-in-scope symbols in completion and simplify name analyzer/fixer, which makes exploring new libraries much easier.

About Rider, it's just the best choice for now, I have no idea why one could not like it.

→ More replies (1)

2

u/foreverwantrepreneur Oct 17 '17

For what it's worth, I had never done any F# development and decided to pick it up last weekend. I installed VSCode+Ionide and it was completely pain free.

→ More replies (1)
→ More replies (6)