Day 1: Setting Up

Summer of Code officially started on the 19th, with an exam the following day and another four days later I did not get much done this week! So, hot on the heels of Understanding Programming Languages yesterday, I decided to configure my environment ready for some development.


Gentoo is an empowering distribution, but at times can feel like a self-inflicted disability.

F# bindings for MonoDevelop will make life much easier (I do not fancy writing an fsproj file by hand!). Unfortunately the ebuild is a live one (i.e. direct from Git) and failed to compile on my system. The first hurdle appeared to be applying an assembly redirection from the requested FSharp.Core assembly version 4.3.0 to 4.3.1. Oh dear!

Luckily, the overlay system allows me to easily create my own package for the 4.3.0 assembly, working around the problem, but I still couldn’t get the bindings to compile. After many hours of fiddling, I managed to install them for my user. Not ideal, I’ll need to manage updates myself, but at least I can get started now and have some experience with the F# compiler.

Tentative Steps

With the above done, I could now create a project. BCM (Banshee Community Extensions) is mostly written in C# and provides a script for quickly creating a new extension. Using the script and existing C# template project as a starting point gets us some build infrastructure and an XML file for Mono.Addins which we can easily customize.

At this point, we note that Automake wants to use the C# compiler on our F# files! Redefining the MCS variable (among other things) works as a Quick Hack and highlights some differences between the two compilers. I’m not sure why, but although the option names are the same, F# compiler requires a second hyphen in front of each… <sigh />

A Cautious Hop

Finally, at this point there is some code to show. It’s a tiny example containing no moving parts but is useful for two reasons; first it shows an F# newcomer (me!) some of the syntax for polymorphism and secondly, combined with the prior ground work gets us to the point where we can see an effect on the outside world, i.e. the extension can be loaded by Banshee and we see an (at present) icon-less source appear when it is enabled.

namespace Banshee.Template

type Source() = 
    inherit Banshee.Sources.Source ()

type Service() =
    interface Banshee.ServiceStack.IExtensionService with
        member this.Dispose () = ()
        member this.get_ServiceName () = "TemplateService"
        member this.Initialize () = printfn "Starting TemplateService"

Next Up

The most logical next step would be to tidy up the changes I’ve made to enable F# projects to build, figuring out what changes are needed to get this done via GNU Autotools is definitely a priority. Porting the rest of the C# template extension to F# is also an ideal candidate for attention due to the valuable language experience that I would gain. Once done it would be useful to expand the extension creation script for other users, though that has a low priority. Finally, today’s work provides an excellent place to start prototyping.

A slow day, not many achievements but each one felt significant.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s