Monday, October 22, 2007

One more sharp language from Microsoft – F#

I have read about F# initiative taken by Microsoft Research lab few years back. I happened to visit the F# initiative again today and hence this blog.

So, what is F#? Is it one more .NET based language with some more cool features? Or is it altogether different programming language?

Well to start with F# is nothing but typed functional programming language for the .NET Framwork. So, next obvious question is what do you mean by functional programming? Well, here is the definition from Wikipedia:

“Functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast with the imperative programming style that emphasizes changes in state”

Most of us may have studied functional programming language in our academics. And that language is called as Lisp. Now, you can relate to the above mentioned definition.

However, F# is not simply a functional language: it is a multi-paradigm language that attempts to capture the best of both functional and object-oriented programming in the context of .NET. Furthermore, even when used as purely functional language F# is remarkable for the sheer power of the libraries and tools available through .NET. F# was designed to be first class citizen on the .NET giving smooth interoperability with other .NET languages. It means that F# can call C#. It also has access to .NET framework APIs, Widnows Presentation Foundation, Windows Communication Foundation, DirectX etc. F# and Ocaml (one more general-purpose programming developed by France National Institute) share a similar core language.

Following are some of the features of the F# language:
•Support for the functional programming features including tuples, lists, options, function values, local function definitions, pattern matching and sequence expressions.
•The powerful type inference mechanisms.
•Support for advanced functional programming constructs such as active patterns and computation expressions.
•F# embraces object-oriented programming and includes support for type-inferred, succinct descriptions of object types.
•Allows types and values in an F# program to be accessed from other .NET languages in a predictable and friendly way.
•Support for a form of meta-programming, inspired by LINQ. This allows data queries to be expressed and type-checked in F# code and then dynamically compiled and translated to target languages such as SQL using the LinqToSql framework.
•Supports .NET generics.
•Supports advanced language and runtime features such as Unicode strings, dynamic linking, preemptive multithreading, and SMP support.

The key application areas for F# on the .NET platform are:
•Mathematically oriented programming
•Scientific and Engineering tasks
•Hardware verification, software verification, optimization, machine learning and compilation etc.

You can find more information on the Microsoft Research home.

Latest update is that Research team is planning to integrate F# with upcoming version of Visual Studio.

So, what it means to programmers? Some one has correctly said, “programmers would chose the best language to write each piece of a coding task, just as a carpenter uses a hammer for one task and a saw for another”.

Cheers,
Amol

No comments: