Tuesday, November 03, 2009

F# under the covers VII

Working with nCover to examine the number of code-points represented by any given method, the October CTP made a large number of changes -- some up, some down -- to the code generated by the compiler.

Most interesting is the change to attribute setters, which used to be NOP;assign;return and are now just assign;return. Also the name of the implicit backing field has changed to be the property name with an appended '@', rather than being a case-mangled version of the property name.

(As always, talking about Debug builds).

Later ... This one is a bit too cryptic for me to decipher what I was writing about. Code like this:

type internal Context = {
Line : int;
Column : int;
EndLine : int;
EndColumn : int }
view raw gistfile1.fs hosted with ❤ by GitHub

Has internal fields like Line@ still at 1.9.9.9; and property setters as in

[<DefaultValue(true)>]
val mutable private points : int
member self.Points with get() = self.points and set(v) = self.points <- v
view raw gistfile1.fs hosted with ❤ by GitHub

compile to the NOP-bearing

.method public specialname instance void set_Points(int32 v) cil managed
{
.maxstack 4
L_0000: nop
L_0001: ldarg.0
L_0002: ldarg.1
L_0003: stfld int32 MyTestClass::points
L_0008: ret
}
view raw gistfile1.cs hosted with ❤ by GitHub

with the Feb 2010 CTP.

No comments :