Looking at F#

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!

Comments 4

  • (Testing another of Mark’s super-whizzy devices…)
    We need to see examples of the language syntax!
    M.

  • So, time for a game of xbattle?

  • 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!

  • 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…