Tuesday, September 15, 2009

F# under the covers III

To date we've seen examples where some simple F# code maps to something horrid in the C# view we get from Reflector.

Now for something completely different...

Simple properties like

map quite directly from F# into IL, even in debug build

where set_Points just assigns straight into the field, and get_Points just returns it, roughly as expected.

The corresponding C#

becomes

The set_Points code is the same, modulo the maxstack -- but what are that temporary and that branch doing in get_Points?

This is a bit of a "lolwut!?" discovery!

Reassuringly, the release build of the C# get_Points is almost a nop-free version of the F# debug code

but as the debug version is the one for doing code analysis on, that's less useful.

This is unchanged with the Feb 2010 CTP (1.9.9.9).

Post a Comment