Looking at F#

Mark on May 23rd 2006

In my “copious spare time” over the past couple of weeks, I’ve been using the new F# language out of Microsoft Research.

It looks great. The F# language has a rock-solid heritage, from the ML family of functional programming languages. So, you get higher-order functions, strong typing with type inference, parametric polymorphism, closures, datatypes, and exceptions. But (unlike those whacky lazy functional languages such as Haskell) you also get strict evaluation like you already understand, side-effects like you know and love, and references like you just sometimes need. F# is more directly descended from Objective Caml, so you also get objects and classes.

What F# adds to the mix is seamless .net integration. You just tell F# about where a .net dll is, and then all of that managed code becomes available to call as if it were written directly in F#.

But F# is not just about the language itself - there’s also a good Visual Studio integration. Compared to the good old days of hacking around with Standard ML just on the interpreter command line, it’s a real pleasure to have an IDE with interactive debugging, and dynamic hints while-you-code, about types and about available functions and arguments.

Of course F# still has an interpreter too (also somewhat integrated with Visual Studio). Working with an interpreter is a huge productivity boon. It’s the ultimate in agile development - you can build your code from the “inside out”, so you always have working software without needing all the initial overhead of scaffolding for your proto-system.

The guy behind F# is Don Syme, another Aussie who shared an office and a PhD supervisor with me in Cambridge in the late ’90s. Beaudy Don!

Filed in Software | 4 responses so far

4 Responses to “Looking at F#”

  1. Michael May 31st 2006 at 07:47 am 1

    (Testing another of Mark’s super-whizzy devices…)

    We need to see examples of the language syntax!

    M.

  2. Don Syme Jun 6th 2006 at 10:53 am 2

    So, time for a game of xbattle?

  3. Don Syme Jun 6th 2006 at 10:58 am 3

    Re the interpreter - one fun thing is that it’s a dynamic compiler, so the code you enter interactively gets fully optimized and run as native code. It can even occasionally beat C++ equivalents, which gives you a right jolt the first time you see it!

  4. Mark Jun 6th 2006 at 07:44 pm 4

    Xbattle? Michael’s got a linux box, and I guess I could dust off one at home, but surely you don’t Don? :-)

    Maybe you should write an F# WinBattle. There’s a C++ WinBattle at codeguru.com, but it was a bit flaky last time I tried it…

Trackback URI | Comments RSS

Leave a Reply