How to get started with the new release of F#
Posted by Brian on May 20, 2009
With the new release of F#, you have a few alternatives for grabbing these new bits to play with the latest F#:
- Install Visual Studio 2010 Beta1. F# is now one of the core languages "in the box"! Choose this option if you want to use the new stuff in VS2010 and .Net 4.0 and can afford the huge download/install. (Applications written in F# in VS2010 Beta1 target .Net 4.0 Beta1.)
- Install the F# May 2009 CTP Update for VS2008 (msi). This installs the latest F# bits atop your existing VS2008 (or VS2008 integrated shell) installation. Choose this option if you want to update F# without having to download & install VS2010 Beta1. (Applications written in F# using these bits target .Net 2.0/3.0/3.5.)
- Download the F# May 2009 CTP Update for VS2008 (zip). This contains the F# redist, including things like the compiler (fsc.exe), the interactive command-line tool (fsi.exe), and the code library (FSharp.Core.dll). Choose this option if you don’t have VS or are using mono. (Applications written in F# using these bits target .Net 2.0/3.0/3.5.)
Note that if you have a previous version of F# installed, you will need to uninstall it before installing the May 2009 CTP Update. (You can install VS2010 Beta1 side-by-side with an F# CTP.)
If you’ve used F# before, you may be curious about the most likely breaking changes (upgrade risks). F# 22.214.171.124 binaries (the new release) are incompatible with F# 126.96.36.199 binaries (the prior release), so all code must be recompiled. There are some revisions to the language and library relative to the prior CTP, but in our testing, source code migrates extremely smoothly/easily (e.g. often with no source changes, just lots of warnings about deprecated library functions that have been renamed to something else). One exception is the Array.sort function, which previously sorted ‘in place’, but now, for regularity with the rest of the library, returns a fresh array (the ‘in place’ version has the new name Array.sortInPlace). The other noteworthy bit is that if you rely on the PowerPack, you should wait to upgrade to VS2010 Beta1 until we publish the updated (188.8.131.52) PowerPack for .Net 4.0 Beta1 (due to some minor snags, it’s not online yet; hopefully very soon). (For those using the CTP Update, the PowerPack binaries are included in that distribution, so you’re good to go today.) By all means, if you have specific questions about migrating your code to this latest release of F#, ask questions on the Q&A sites I mentioned in a prior blog entry.
New with this release: for the first time F# has some documentation on MSDN. (At the time of this posting, there is a minor known bug in the walkthroughs where the code snippets all have extra leading whitespace. Since F# is whitespace-significant by default, be sure to delete this leading whitespace when copying snippets.) These new docs are another good F# reference, as well as a resource for getting started with the language. The F# samples on the MSDN Code Gallery have been updated; these samples are another way to get started with the language by checking out some code.