Jeremy W. Sherman

stay a while, and listen

Here's to iOS apps in F#

At Build 2016, Microsoft announced that Xamarin is free with all versions of Visual Studio, and the Xamarin SDK will be open-sourced.

My first thought was: iOS apps in F#? Lemme at it!

Why F#?

Swift is going through growing pains, and it’s still substantially a statement-oriented language. It’s supposed to be very comfortable if you come from a blocks-and-braces background, with seamless interop with C and Obj-C, and it’s executed on that wonderfully. If you were hoping for a more truly functional language, though, it’s kind of a downer; its gig at the bleeding edge seems more generic programming than functional programming (“C++ done right”).

F# benefits more directly from the long evolution of ML languages. It’s been public longer, and it’s got a good pedigree: Microsoft have done interesting things with all their languages over the past decade, and F# is no exception.

It might be “grass is greener”, but I’d like to take that for a spin and kick its tires, without having to up and move to a completely different target platform.

Interested?

F# for Fun and Profit is really great for learning about F# and why it’s good stuff. It’s organized less like a blog and more like a collection of series of instructional content.

Here’s their one-page summary of “why use F#”. Most of the bullets apply as well for Swift as for F#, but the core difference of expression-orientation rather than statement-orientation – not called out there – matters quite a bit in how easy it is to compose expressions and extract expressions as independent functions. (The workflow/computation expression sugar is quite nice, as well, and of course F# for Fun and Profit has a series teaching it in detail.)

If you prefer to listen rather than read, then check out:

Both of these also get into introducing F# in the workplace, if that’s something you’re motivated to tackle.

Why Xamarin?

Xamarin was $$$ before, but this drops the price of adoption for me (and anyone inheriting my codebase) significantly. Adoption costs matter!

As a bonus, if I can be like, “Hey, you’ll get an iOS app, and you’ll get a pile of platform-independent code you can point at Windows, Mac, or Android afterwards,” that seems like a win all around.

But really, I want a shot to use an expression-oriented language today as my main language.

Warning: Untested Speculation

I haven’t actually tried to do this yet. It might go down in flames in practice when I try to get everything lined up and working together; lots of things sound good in outline that fail in implementation.

If I throw an afternoon to it some time in future, I’ll check back in with an experience report then.