Getting started with the F# and .Net ecosystem
prigrammer.com
prigrammer.com
My quick thoughts: Beautiful language. There's quite a bit of a learning curve for some of the more advanced features, but a large portion of the language is very readable and succinct Additionally, I love how the language has helped me become a better developer. Far fewer bug, and none of them are null-related After my former lead left, I've had difficulty introducing new teammates to the language. It's hard to convince C# devs to try it out I've been looking around for a long time, but there seem to be very few teams that are hiring F#. It doesn't help that many aggregate job posting sites fail to show useful results when searching for "F#" Negatives aside, I really enjoy programming in F# and if you were on the fence, I'd say to give it a try!
https://channel9.msdn.com/Shows/On-NET/A-tour-of-F-with-Phil...
There are two passages that I found amusing.
First the guest mentions the merits of F#'s deep implicit typing, where the use of a function at the top may determine the typing of other nested functions. And as one would expect with this level of things happening implicitly, it is very easy to get lost in what is going on, which is exactly what happened to the guest at minute 27, where he couldn't figure out why the F# compiler wasn't implying the correct type.
Later on the guest mentioned that for all their API, they actually create a signature file (i.e. a header file) where you have to declare every function signature separately from the implementation. The host diplomatically mentions that perhaps this might maybe be a little bit cumbersome to maintain. The answer is that it's not a problem, as the program simply doesn't compile if you have a mismatch.... Hum.
I like certain aspects of it, not using too many special characters (kind of python/vb style), the immutability, etc. But I can't say I am sold and ready to switch though. And many of what are presented as key features are just not the kind of things I have any use for, like declaring lists of consecutive numbers (can't remember the last time I needed one) or F# type providers (I rarely have to deal with unexpected file data formats).
https://fsharpforfunandprofit.com/posts/function-signatures/
It's the same deal with Haskell, you don't HAVE to specify the types of your code but it can help check your assumptions as to what the compiler is inferring. I've frankly found that a more frequent issue in Haskell because of pervasive use of Monads and other higher-order constructs.
To your second point, about the 'header' (interface) files in ML-family languages like F#--that is a really great feature because it lets you do abstraction and access control. The interface file specifies what callers are allowed to see, you can use them to make your types truly abstract and prevent access to your modules' internal functions.
About lists of consecutive numbers ... not sure what that is referring to exactly. About type providers ... yes, I agree with you that not everyone finds a use for them. In general, I will say that the killer feature of F# and other ML-family languages is that they dramatically increase code refactorability (low-ceremony static types) and dramatically reduce lines of code (simple, 'math-y' syntax).
Multithreading is a good example. It is hard to do at a low level. And I totally get why F#'s approach helps a lot. But I find that you get most of the benefits of multithreading by splitting your task in independant subtasks that are not thread safe but do not share writable data, and run a parallel.for at the top. Occasionally you need some locking if you have a common cache but that's easy to get right.
Sure you could optimize it a little bit more by making it multithreaded at a lower level but most of the time that's enough to get 90% of the performance benefit.
I am also a bit uncomfortable with the liberty F# takes with memory. To make everything immutable you create a lot of copies in memory. All the .net performance articles I have read mostly focus on taking it easy with the garbage collector and reducing the number of allocations. Intuitively it doesn't sound like an obvious trade off (thread safety vs more garbage to collect).
About multithreading, not sure what you mean but F# definitely has parallel collections in addition to its general async capability that lets you handle concurrency in a safe way. If you haven't already, check out the Hopac project (http://hopac.github.io/Hopac/Hopac.html , scroll down to the Description section).
About memory use, yes you create copies but at the same time immutability means you can have persistent data structures which share and thus save a lot of memory. Also, in general performance is good enough that you don't really have to worry about it, and when you do, you can always measure, profile, and see what's actually causing the memory pressure.
That said, it's true that functional programming languages have a different memory profile than imperative languages, and implementations which have been designed with this profile in mind perform really well. E.g. check out OCaml's performance in this GC pause benchmark: https://making.pusher.com/golangs-real-time-gc-in-theory-and...
I wish there were more F# jobs - its a very interesting language.
And Kaggle, and Credit Suisse, and...[2]
[1] https://www.elastic.co/blog/solidifying-releases-with-fsharp...
I stumbled upon the following response on SO that helped me to move past using interfaces to passing functions instead.
https://stackoverflow.com/questions/34011895/f-how-to-pass-e...
I have been wanting to break into F#. At work I use PowerShell on many Windows computers. I could write PowerShell modules in C#, but F# would allow me to think like I would if they had been written in Haskell.
I am also working on a small web application with C#. (M101N course via MongoDB Uni.) I'm keen on re-implementing in F#, just to see how both compare.
Appreciate the getting started guide!
https://web.archive.org/web/20170607134504/http://www.prigra...