Posts for #Functional Programming

Here’s the abstract I submitted for a birds-of-a-feather session at TechEd US:

Benefits of Functional Programming ideas in the context of parallelization efforts

As many of you have probably heard at some conference already, I have recently started writing a book for Wrox on “Functional Programming in C#”. I’ll try to blog about the topic a bit more, though I find myself not blogging very much at the moment… too much stuff to do. Anyway, I sat down with Keith and Woody at PDC this year and recorded a podcast on FP in C# – well, on some of the basics at least. If you’re interested, here it is:

Episode #23: Functional Programming in C# with Oliver Sturm

Editor’s note: In case you’re reading this in 2019, like I recently did, it should be pointed out that this opinion piece was written in the early days of F#. The language has since evolved in a variety of ways, which is not to say that the problems described below are necessarily solved today – but the position of F# in the landscape of .NET languages is now clearer than it was and I don’t agree anymore with the proposals I made in 2008.

In my continuing efforts to make XPO work fully with F#, I found the next problem to deal with: the extremely linear way of thinking of the F# compiler.

I was playing around a bit today with F#, trying to write some real code that interfaces with WPF. Here are a few things I found – very much a “note to self” thing, but if you happen to be interested, please comment or ask.

Number 1 - implementing interfaces that include events is a PITA

I just spent a little while hunting down an interesting problem in a little F# app. I had a bunch of code in a single file and I was going to structure it a bit and move certain parts into separate files. I started out from some code like this:

namespace Sturm.MyNamespace

type ICommandLine = begin
  abstract member Parts: string list

type IPlugin =
  abstract member CanHandle: ICommandLine -> bool
  abstract member Handle: ICommandLine -> unit

type blah =
  val mutable dummy: int
  interface IPlugin with
    member x.CanHandle(commandLine) = false
    member x.Handle(commandLine) = x.dummy <- 1
  new() = { dummy = 0 }

So here they are, the slides and samples of that Functional Programming in C# 3.0 session. My apologies for the slight delay - I already received a few emails about it - but my flight home was cancelled yesterday and everything was a bit chaotic.

Functional Programming in C# 3.0