Saturday, December 12, 2015

What’s new in F# 4.0 in Visual Studio 2015

Hi my blog readers!
Today I’m going to share information about F# in Visual Studio 2015.
When Visual Studio 2015 was first released, F# was also released as F# 4.0. Put it simply, Visual Studio 2015 has F# 4.0 in it, or you can view it other way: F# 4.0 was released at the same time as Visual Studio 2015 released.
A complete list of F# 4.0 new features, enhancements and bug fixes are available in F# Github repository in the form of markdown page:
There many nice features and bug fixes! But for me, based on the previous link, the nice parts of new features of F# 4.0 are:
  1. Constructors can be treated as first class functions
  2. Support for high dimensional arrays is now in sync with .NET 32 dimensions array. Previously F# only supported up to 4 dimensional arrays.
  3. Synchronize of “API parity” for List, Array, and Sequence, including additional new APIs: chunkBySize, contains, except, findBack, findInstanceBack, indexed, item, mapFold, mapFoldBack, sortByDescending, sortDescending, splitInto, tryFindBack, tryFindIndexBack, tryHead, tryItem, tryLast
  4. Slicing support for List
  5. Supports for VS debugger for debugging F# script
Important notes:
  1. Slicing support for List is quite comfortable, but please be careful that this List is F# List, not the original .NET’s System.Collections.Generic.List. F# List is implemented as linked-list, this is why the original F# List has no inherent support for index before F# 4.0. Actually and it’s natural to have an index, because slicing support requires to have an index.
  2. High dimensional arrays are not available in all of the F# APIs. There’s no API for manipulating arrays that has dimensions above 4 dimensions.
For more information about the general enhancements, see this blog post:
Tomorrow I’ll discuss the new features above with some samples!