What is the new language F# all about? Where is that going to be useful? And what is Microsoft's future plan (release road map) regarding this language?
|
closed as not constructive by casperOne♦ Jun 14 '12 at 17:56
As it currently stands, this question is not a good fit for our Q&A; format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.
Yes, it's useful. It's useful just like any functional programming language is useful. One reason that I like to learn other languages pertains to the Sapir-Whorf Hypothesis:
There are certain classes of applications (like financial applications, number crunching, etc.) where functional programming REALLY shines. Outside of those scenarios, it's all about using the right tool for the right job. Dustin Campbell has a great post on functions in F#. Curried functions are especially cool. Let's take a simple function that increments a number by 1:
Since functions are first-class citizens in F#, the function definition above is actually a more concise way of saying this:
Where it gets really fun is when you have a function with more than one parameter. In F#, technically there is no such thing, a function with two parameters is actually a function that takes one parameter and returns another function that takes the other parameter and returns the value. So, an add function:
Is actually defined as:
I know, that's a bit of a mind bender at first, but it allows us to do some VERY cool things, like "partially-applied functions" (a.k.a. curried functions). Let's redefined our inc function above to be a partially-applied function based on our add function:
Yes, we just called the add function and only passed it one parameter. This evaluated the first part of the function and returned another function expecting our second parameter. Very cool! As an OOP developer, here's one way to think about functional programming: everything you currently know about functions is incompletele :). A story for you: In the world of Object-oriented development, we tend to eat, sleep, and dream about Objects. Objects are the Manna of Life, a continued source of sustenance for our development body. But what about Functions? Sadly, Functions exist solely to be obedient servants to the needs of their Object masters. Functions are not first-class citizens in an Object world. Functions are relegated to the dingy back alleys and filthy pool halls of development life, sent scrounging to seek out torn and tattered, week-old newspapers just to stay warm at night. They live a life of under-appreciation, doomed to forever swim just below the water level of a developer's consciousness. |
|||||||||||||||||||||
|
F# is all about brevity, interactivity, interoperability and a non-mainstream approach to factoring and structuring programs. F# is useful and, in particular, is much better suited to some applications than C#:
The first full product version of F# was released as part of Visual Studio 2010. |
||||
|
Because if you do not learn it, you are going to be reduced to writing low interest line of business applications. Why? Because C#/VB written in a standard way is full of side effects and mutable stuff. Hence, standard C#/VB code cannot take advantage of multiple cores, vector processors, GPUs, etc. as easily as F# does. Amanda Laucher hits the ball out of the park on this issue with her lang.net presentation. She speeds up production C# code by a factor of 100x by porting it to F#. The C# code was using less than 25% of the CPU of one core. |
|||
|
This video is really good at explaining "why learn F#". http://channel9.msdn.com/pdc2008/TL11/ When I was watching it, most of the time I'm thinking C# has got that, more or less, with LINQ or PLINQ up to and including CPU parallelism, but then he showed IO parallelism and it was awesome. It is really easy to express IO parallelism in F#. |
|||
|
I think right now it would be most useful to do it for interest/learning. However, there are practical applications of functional languages in highly threaded environments. It is also a good thing to discuss in an interview if one of the interviewers has a PHd in computer science. |
|||
|
F# is basically bringing functional programing to the .NET platform meaning an even greater diversity and options to the already well filled .NET toolbox. It's useful since it brings both another paradigm and opens up a different view to think about problems and also since much of functional programming is about avoiding side effect it lends itself extremely well to parallelization. |
|||||
|
F# allows you to easily implement functional concepts, has powerful matching facilities, and extremely flexible metaprogramming. If nothing else, you'll start to think about the structure of your programs in a very different way. Edit: Also, I recommend checking this out: http://research.microsoft.com/fsharp/about.aspx |
|||||
|
Since this question got nice viewership, I thought I'll share a nice article by Scott Hanselman on this topic. Hope this will help some one else. |
|||
|
If you're interested in aspect oriented programming, F# is the way to go... Just learn it anyway, there's no harm in learning a new language... |
|||||||
|