Jun 26

A Taste of F# Interactive in Visual Studio

Here’s a taste of some great new functionality that will be in the next release of F#, which we should have out sometime in the next week or so. The cool thing here is not just the pretty graphics (which you’ve been able to do in F# for a while now), but F# Interactive (fsi.exe) embedded as a tool window in Visual Studio. Click on the screen shot for an enlargement.

Also shown is something I haven’t made much noise about on this blog, and that’s the ability to display windows interactively from F# Interactive. The windows are fully active - they can paint and respond to interactions while the programmer evaluates new expressions, code, types and classes in the interactive session. You can also dynamically load new .NET components on-the-fly.

At the bottom of the screen you’ll see a tool window containing the F# Interactive session. The WinForms/DirectX window in the foreground was created by running simple F# code such as

let form = new Form();;
form.Text F# surface plot”;;

as well as some introductory DirectX triangle creation.

The code shown in the editor is part of this script - we’ve just executed the command that specifies a new function to display (this is the line highlighted in the editor). We did this just by evaluating the code in the F# Interactive Session below using a key short-cut. (I’ve scrolled the F# Interactive window back up to the top so you can see the banner printed out when F# Interactive starts up.)

What’s really striking is the combination of interactive visualization, Visual Studio, .NET programming and efficiently executing F# code (remember, .the floating point code is running as optimized native code, often close to C++ speed). We have a few things to add before this is complete: for example some form of intellisense in the interaction window. But this combination feels like it is bringing many things together nicely. (Aside: you can of course do interactive visualization when using F# Interactive from Emacs too :-) I’m not so sure about “vi” !!)

Jun 26

Rob Burke on F#

Rob Burke has just written a blog entry on F#:

Jun 26

F# Books, and F#/XAML

I’m glad to report that Robert Pickering’s book Foundations of F# will be out soon. I’ll be writing more on this soon - it was a pleasure to work with Robert and Jim Huddleston as technical editor on this book, and I’m sure you will find it a great entry-level introduction to F# programming.

Speaking of which, I’m deep in writing mode at the moment, concentrating on finishing the draft chapters for Expert F#. This week it’s Chapter 8 - “Common Techniques”. Last week was Chapter 14 - Concurrent, Reactive and Asynchronous Programming, alluded to on The Hub. Writing this chapter has led us to make some really nice additions to the language, which will be in the next major release.

Jon Harrop has just posted an interesting blog post on writing XAML-like descriptions directly in F#. Robert Pickering also has a post on using WPF and XAML from F#. Robert Pickering has also been working on Silverlight programming with F#, though he’s not posted anything yet. I’ll also be posting more on our plans for leveraging the facilities offered by the DLR initiative, especially the integrated script hosting in Visual Studio and elsewhere.