Tuesday, 12 October 2010

WebSharper ¦ F# User Group

The London user group had Adam Granicz tonight talking about WebSharper in general and the upcoming version 2.0 in particular. While I like shiny new tools/toys like the next guy, I don't do much web development these days, and didn't have very high expectations. JavaScript isn't one of my favourites, and the last cool technology I remembered was the beta of ASP.NET MVC... But I must say that the presentation was way impressive. Writing web apps for the client side using a proper programming language (F#) and model seems a big step forward, and having components on the server and client communicate seamlessly using function call semantics is genius. I still have a number of doubts and questions, but there was little time and I couldn't make the social bit because I had to catch the train (which I am now sitting on, incidentally), so they have remained unanswered for now. But I understand that there is another WebSharper event here in November, and I intend to be there and report back.
--
Sent from my Android phone.

Sunday, 10 October 2010

Google Reader API for F#

The Google Reader API, as used by different desktop and mobile RSS feed readers to synchronise settings and contents, is still officially unofficial, but there are four or five resources on the Internet with some information (and which somehow all link to each other..). I found it a bit difficult, though, to get any working source code. There were some changes earlier this year with regards to the authentication mechanism, but most what is published about the API appears to have frozen in time around the end of 2009. Looking for information on the inner workings of the API for some software I wanted to write in F#, I came across this post by Sandrino Di Mattia who wrote a whole C# library based on the latest API version, which can also be downloaded from his blog.

Now, this isn’t exactly what I wanted to do myself, mainly because it’s in C#, but also because it is using only synchronous requests. But I found his explanations very useful and the code itself is well written, so I decided as a first step in my own project to replicate this in F#. It is quite a straightforward translation from one language into the other, so the whole code looks like written in C# using F# syntax (which it is), so probably not nice to look at if you’re a functional purist. But as an example I find it useful enough to put it on CodePlex. Sandrino has kindly agreed to make his code freely available, and I have put the F# version under an MIT licence, so if you should need this sort of thing, please peruse at your leisure.

I will not further develop this, but will see to it that bugs are fixed when they are found; please use all those CodePlex tools in order to report problems and discuss issues.

The code can be loaded into Visual Studio 2010 and built and run without further ado, although you will need an Internet connection. There’s an F# library project, accompanied by a console application to play around with.

Friday, 8 October 2010

F# back-ticked identifiers

You can use almost every character sequence as an identifier, if you enclose it in a pair of double-backticks. It's in the language reference (3.4) but I only just noticed last night. Did everyone else know about this?
Of course, this can make it impossible to use the identifier from C#, unless you slap a CompiledName attribute on it.
--
Sent from my Android phone.