views:

272

answers:

8

Foundations of F# and Expert F# are probably the two most prevalent books used to learn f#.

Both were written at the time of the 1.9.2/1.9.3 releases. The website for the Expert book has some errata and details some of the changes in the 2008 CTP release which were relatively minor.

However the CTP release for the 2010 beta (and the corresponding 2008 compatible release) 1.9.6.16 changes much more.

Since the MSDN documentation is largely non existent, especially in terms of changes and data is scattered around blogs I am finding it harder and harder to rely on the current books (especially the expert one) since the f# landscape has shifted too much underneath it.

This question seeks to provide a (hopefully) comprehensive list of those areas which have changed and short details/links to further reading on how to deal with this.

As the basis for this I have added some issue which impacted myself. The previously linked blog post lists many of the changes in terse form and is a good place to start but it doesn't cover everything by any means.

Attempting to keep to a specific aspect per answer would be sensible since this will make reading it easier.

In specific question form:

What changes have occurred to f# from 1.9.6.3 to 1.9.6.16 that render previous examples (especially dead tree documentation not amenable to easy correction) incorrect or deprecated and what remedial actions are possible.

+1  A: 

Events

Expert F# Chapter 8 section: Events and Wiring

IEvent is entirely deprecated. Instead the various functions are defined on Event instead.

There is no longer any need to use create_HandlerEvent to make a completely compatible .Net event (one consumable from, say c# easily) instead you use the CLIEvent attribute.

If you make your event via DelegateEvent<T> then the resulting event is usable without requiring any reference to the FSharp.Core dll. If you use Event<T> then you must include a reference to the FSharp core to be able to use it.

ShuggyCoUk
A: 

#light

#light is the default, as a result some examples online will not compile.

This has a relatively minor impact since most examples used #light anyway.

ShuggyCoUk
+2  A: 

The signature of Array.sort changed; it used to be in-place, whereas now it returns a fresh array and Array.sortInPlace sorts in place. (That's been a minor problem-point for customers; most other library-renames issues deprecation warnings that steer you in the right new direction, but in this case the function still works, but has a new signature, which can make this difficult to diagnose at-a-glance.)

http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/manual/FSharp.Core/Microsoft.FSharp.Collections.Array.html

Brian
I was hoping you would add some :) I forgot about that one
ShuggyCoUk
+2  A: 

A number of books were written before FSharp.PowerPack.dll was split out of FSharp.Core.dll, so for many examples you need to ensure you've added a reference to the powerpack to gain access to certain library functions.

See also http://blogs.msdn.com/dsyme/archive/2008/08/29/detailed-release-notes-for-the-f-september-2008-ctp-release.aspx

Brian
+1  A: 

Naming convention changes

  • removal of most '_' within function names
  • removal of deprecated functions

Specific examples and their resolutions

  • List
    • reduce_left to reduce
  • Seq
    • sort_by to sortBy
    • group_by to groupBy
    • init_finite to init
    • Several functions including cons and generate_using removed
  • Array
    • scan1_left to scanReduce
    • reduce_left to reduce
ShuggyCoUk
A: 

Syntax changes

  • with member ... and support removed. Use explicit member this.Foo for each
  • 1.9.4 changes
    • the change to Symmetric Operator Overloading.
    • subtle changes to the handling of nulls with boxing and option types
ShuggyCoUk
+1  A: 

Multiple types have moved from being part of the dedicated F# runtime (child namespace of Microsoft.FSharp, in assembly FSharp.Core):

  • bigint now an alias for System.Numerics.BigInteger.
  • Tuple is now System.Tuple
Richard
good point, should I edit this to add in the other types that 'moved' to the 4.0 ones like Tuples and the like or do them separately?
ShuggyCoUk
Expanded to include multiple types, feel free to add more.
Richard
A: 

F# for Technical Computing is the only book to cover the latest version of F# (and WPF, and the TPL, and ...).

I believe second editions of Expert F# and Foundations of F# are in the works.

Jon Harrop
I'm not the -1 but I'm afraid that this as an answer (given the title) is borderline spam. Perhaps moving it to be a comment on the question itself would be appropriate)
ShuggyCoUk