Sunday, June 07, 2009 6:21 PM
by
RickM
Discoveries This Week 06/07/2009
There has been a huge spike in the number of F# posts over this past couple of weeks. For this post I have chosen those I think are most important for the experienced F# programmer to read. This week we have Common mistakes, the inner workings of Printf, the dangers of null types, and my personal favorite: a Lisp compiler in F#.
In this post I'm going to cover the final step in the compilation process, the generation of the IL itself. By IL, I'm referring to the Common Intermediate Language, the low-level machine-independent opcodes that the .NET JIT compiler turns into native machine code at runtime.
Tim’s series is one of the best I’ve seen on IL generation in F# and the only I’ve seen on writing a Lisp interpreter. Very cool.
I really love introducing new people to functional programming. At some point they get a kind of light bulb moment and start to feel really empowered by it. However, up until that time, there is some work and frustration in switching from an old comfortable paradigm to a new one.
A great post for both beginners and teachers. I’ll be mentioning some of these points in my upcoming Code Camp Hartford 2 talk.
F# was supposed to free us of the tyranny of the unchecked null. Alas not only does it not do that, it introduces several more kinds of null. First consider this all too common problem in C# code.
Jonathan makes a good point here. I wish it were possible to have all F# calls which return null to be automatically converted into option types. However, if programmers are careful with post conditions on calls into the .NET framework, and so avoid null in F#, it won’t be a significant problem.
Hello, I've been loving F# so far, but I've run into something I'm quite puzzled over. My goal is to bind a function to write to a specific text writer. In the following code, test1 compiles, but both test2 and 3 fail with the same error (on pn "test"): "This expression has type unit but is here used with type string -> unit".
After much discussion it’s interesting to see Don finally weigh in on the subject. I must say that I’m disappointed that Printf uses compile time code generation and so I wouldn’t be able to implement the same kind of thing myself.