Thursday, February 10, 2011

Cecil.Decompiler and F#

In this new post-Reflector age, I thought I'd have a look-see how the main competition worked on F#. So I whipped up a simple driver for Cecil.Decompiler:

and tried it on an assembly of some fairly simple F# -- a few extension methods for Option

and we get things like

This is better than Reflector was when I first tried it about 18 months ago -- F#'s cluster of branch instructions

caused the old Reflector to just crash.

F#'s habit of lacing in temporaries did flummox the decompilation a bit:

compared with the current Reflector's take of

MonoDevelop 2.4.2.'s Assembly Browser gets it a bit better than the raw decompiler, though it still has the same 'C'-style if in there:

Amusingly, I was able to get the decompilation to throw by feeding the little driver program into itself -- the DumpAssembly method would not turn back into C#! MonoDevelop silently refused to load the contents of the whole assembly.

Post a Comment