Tuesday, October 20, 2009

F# under the covers VI

First results from the October CTP, as ever, using Debug build

let start = lines |> List.min
view raw gistfile1.fs hosted with ❤ by GitHub

turns up FxCop warnings

warning : CA2208 : Microsoft.Usage : Method '...' passes 'source' as the 'paramName' argument to a 'ArgumentException' constructor. Replace this argument with one of the method's parameter names. Note that the provided parameter name should have the exact casing as declared on the method.

because the operation is in-lined, with code that maps back to C# as

if (enumerable == null)
{
Operators.Raise<Unit>(new ArgumentNullException("source"));
}
view raw gistfile1.cs hosted with ❤ by GitHub

and then immediately follows this with a similar in-lined ArgumentException.

With the new CTP we now get, on a method that used to check clean

On method 'Patterns.As<Target>(object)', prefix generic type parameter name 'Target' with 'T'.

but that's just a minor and easily fixed issue; and also

// A shared object for serializing operations
let Mutex = new Object()
view raw gistfile1.fs hosted with ❤ by GitHub

now gives

warning : CA1810 : Microsoft.Performance : Initialize all static fields in '...' when those fields are declared and remove the explicit static constructor.

A simple test with 1.9.9.9 reproduces the first two, but not the last. The object is now a static member of the synthetic <StartupCode$[assembly name]>.[FileName] static class, and exposed as a property of the module.

No comments :