OCaml first hit my radar in November 2013. I had just learnt SML, a similar but older language, in the excellent Programming Languages Coursera course. Dan Grossman is one of the best lecturers I’ve ever seen, I found his explanations hit all the right notes and made learning easy. The simplicity of the SML syntax, and the power of the language while still producing code that is readable with minimal training immediately appealed to me.

Over the last 3 years I have tried, and failed, to learn Haskell. The combination of minimalist syntax, pure functional programming style and lazy evaluation is like a 3-hit sucker punch that is very hard to grasp all at once. Having now learnt SML and OCaml, which like Haskell are based on the ML language, that has changed. I have yet to put any more effort into learning Haskell, but it is now clear to me that the syntax is only a small leap from ML and the pure functional style has similarities to SML.

I still don’t want to write production code in Haskell, but the fact that I find it less scary than I used to indicates I have made a significant jump in my knowledge and, arguably, career in the last 6 months.

Dynamic typing

Before I go any further, I need fans of dynamic typing to exit the room. My 12 years in the industry have set my camp firmly on the static typing side of the fence, and discussions about static vs dynamic will not be productive or welcome here.

So, why OCaml?

Smarter people than me have written about this, but I’ll give it a shot.

I have found OCaml to be a refreshing change of pace. Most of my favourite things are derived from the ML base language; variants, records, and pattern matching combine to create elegantly powerful code that is still easy to follow (unlike most Haskell code I’ve seen).

Ocaml takes the expression-based ML style and incorporates enough imperative features to make it comfortable for someone learning Functional Programming. Don’t know how to use recursion to solve a problem? Drop into a for loop in the middle of your expression. Need some debug output? Add it right there with a semicolon to sequence expressions.

Throw in almost perfect static type inference, a compiler that gives useful error messages and immutable-by-default variables and I just can’t get enough. I won’t sit here and list every feature of the language, but hopefully that piques your interest as much as it did mine πŸ˜‰

Industry acceptance

There is always an element of “I have a hammer, everything looks like a nail” when learning a new language but the evidence that OCaml is becoming more widely accepted is not hard to find.

In the middle of February, Thomas Leonard’s OCaml: what you gain post made waves; the reddit and hackernews discussions are fascinating. A lot of people using OCaml in the industry came out of the woodwork for that one. I’m still working my way through the series of 11 posts Thomas made, dating back to June 2013, about his process of converting a large Python codebase to OCaml.

Facebook have a fairly extensive OCaml codebase (more details below).

It doesn’t take much googling to find presentations by Skydeck in 2010 (they wrote ocamljs, the first ocaml to JS compiler) or a 2006 talk describing why OCaml is worth learning after Haskell.

OCamlPro appear to be seeing good business out of OCaml, and they have an excellent browser-based OCaml tutorial (developed using, of course, js_of_ocaml).

No list of OCaml developers would be complete without mentioning the immense amount of code at Jane Street.

There are plenty of other success stories.

The elephant in the room

The first question I usually get when I tell a Functional Programming guru that I’m learning OCaml is “Why not Haskell?”. It’s a fair enough question. Haskell can do a ton more than OCaml can, and there are only one or two things OCaml can do that Haskell can’t (I don’t know the details exactly, I would think it was zero). I see a lot of references to OCaml being a gateway drug for Haskell.

The answer is JavaScript. As much as I hate the language, JS is the only realistic way to write web apps. Included in the many and varied AltJS languages, both OCaml and Haskell can be compiled to JavaScript but the Haskell compilers aren’t mature enough yet (and I’m not convinced lazy evaluation in JavaScript will have good performance).

In fact, some study has revealed OCaml may be the most mature AltJS compiler of all by virtue of support for existing OCaml libraries.


Late last year I started hearing about OCaml at Facebook. Their pfff tool, which is a serious OCaml codebase all by itself, is already open source – but there was talk of an even larger project using js_of_ocaml (the link seems to be offline, try the video). That presentation by Julien Verlaguet is almost identical to the one he gave at YOW! 2013 and it really grabbed my attention. (Hopefully the YOW! video is online soon, as it’ll be better quality).

To cut a long story short, Facebook created a new language (Hack, a statically typed PHP variant) and wrote the compiler in OCaml. They then use js_of_ocaml to compile their entire type checker into JavaScript, as the basis of a web IDE (@19 minutes in the video) along the lines of cloud9. Due to the use of OCaml for everything, this IDE has client-side code completion and error checking. It’s pretty amazing.

Maturity of tools and js_of_ocaml

The more I dive into OCaml, and specifically js_of_ocaml, the more it amazes me how the maturity of the tools and information reached suitability for production use just as I need them.

  • The package manager OPAM is now a little over 12 months old and every library I’ve looked at is available on it. Wide community acceptance of a good package manager is a huge plus.

  • The Real World OCaml book was released in November and is an excellent read. The book is so close to the cutting edge they had features added to September’s 4.01.0 compiler release for them πŸ™‚

  • OCaml Labs has been around for 12 months, and they’re helping to move the OCaml community forward into practical applications (see the 2013 summary).

  • Ocsigen are investing heavily in js_of_ocaml (among other things) with the next release including an improved optimiser (I can attest to the fact that it’s awesome) and support for FRP through the React library.

Moving forward

Is it perfect? No. Software development is not a one-size-fits-all industry. There are as many articles cursing the limitations of OCaml as there are singing its praises. But in the current market, and with the size of JavaScript applications we are starting to generate, I believe OCaml has a bright future.


We’ve had a few ephoxians on twitter for a while, but early last week we hit some kind of tipping point and now most of the engineers are actively chatting on it. For my part I joined to follow and converse with Brent’s Dev Diary, it’s a cool idea and I might do a bit of dev diary tweeting myself one day. All of a sudden though the team is tweeting about all sorts of things πŸ™‚

I’m still exploring how I want to use this and who I want to follow, so far it’s just a few friends and some well known new media celebrities (who are, as always, responsive to fans no matter how they want to communicate) πŸ˜‰

I don’t think we’re going to get too many more succumbing to the fun so if anyone is interested here’s the list:

I’m sure if there are people I’ve missed they’ll be pointed out to me shortly and I’ll probably update this post.

I normally try to get at least one post out per month, but the last month or so hasn’t exactly been normal. Things have been really, really busy at work – that list is from our release 2 weeks ago! While the end is vaguely in sight things are still a bit insane at the moment, so who knows when I’ll get to posting about cool stuff from what is now a two month old release 😦

Probably the biggest news in the last month is that we hired a new engineer (can’t believe nobody’s blogged that yet). Kristin is doing quite well so far – despite being the first female engineer we’ve had in about 5 or 6 years she has been gelling with the team with surprising speed. Even more surprisingly, she didn’t run screaming from some trial-by-fire bugfixing as we struggle to fit training into the current workload πŸ˜‰

It’s nice to know our hiring process still works really well. Somehow we always manage to pick the people who are a match for our culture πŸ™‚

After a busy day of merging and releasing, the release build of 6.4 popped out of our build machine around mid afternoon. I went to break out the beer only to discover that the fridge had died at some point during the day and the beer was all warm 😦

When I first switched to OSX I went looking for desktop blog editors. Much like Suneth just found out, the only two I considered worth using are Ecto and MarsEdit. Unfortunately, MarsEdit doesn’t have a rich text editor; it has notepad with some macros and a rich text preview.

Each to their own, but this mindset of “rich text HTML editors suck” seems to be common among people who love MarsEdit and is no doubt the reason why they all buy it. Having worked on rich text HTML editors for nearly 7 years now, I have but one thing to say.

If you hate rich text HTML editing, you haven’t used a good editor.


I think this review from Shawn Blanc pretty much sums up what I’m talking about:

MarsEdit’s long-time competition, ecto, offers both a HTML editor and a WYSIWYG editor. Unfortunately, when writing in ecto, you cannot switch between the two editor windows without shooting you markup in the foot. If you begin in ecto’s HTML editor and switch to the WYSIWYG, ecto turns all your hand-coded CSS-friendly tags into HTML spans, which is, to say the least, highly annoying and extremely counter-productive.

Clearly, having that happen to you would suck. I can’t do much with styles using the fairly basic setup but I have been annoyed at times by Ecto messing up my HTML (long time readers will remember I picked it as the best of what was available at the time).

At Ephox however, we do our best to make sure EditLive! keeps tags in the format they were loaded (after a few whitespace adjustments to make it more readable in code view). If you give us font tags, we leave them intact despite the fact that they were deprecated in HTML 4. If you give us a tag we don’t recognise, we just display a little marker to let you edit it and continue on. The only time we force span tags is when we create them to apply formatting.

And that’s just one example. We have full control over the entire HTML filtering and rendering process with substantial extensions to the basic Java capabilities. We’ve had to bend over backwards to support strange markup over the years but usually we can do it.

I’m really proud of our editing experience too, we sneak in little usability improvements whenever we find them or they’re requested via support. I’m such a big fan of the editor that a few months back, sick of using text editors to work on HTML documents in support, I spent a couple of Creative Coding Afternoons to write a very basic desktop wrapper around EditLive! and add it to the windows right click menu for HTML files. And I’m not the only one.

We dogfood EditLive! all over the place. It’s the only option when editing our wiki, which is used a lot, and ensures that we always remember to provide a good editing experience across many levels of user technical skill. Most of our blogs (including LiveWorks) use EditLive! to the produce content. Most people in the company use the editor regularly, some of them every day.


It’s not all good news though. I could tell you to try our demo, but there are some annoying restrictions for mac users (we can’t use command-shortcuts because Safari eats them, so you’re stuck with windows style eg CTRL-B). The editor is also less than perfect for blog editing due to difficulties with DIV tags, we’re fixing that in 6.4 but there aren’t any demo pages featuring it yet.

And to top it all off, we’re beginning to shift away from small end-user sales with what is now an industry-wide enterprise focus. So unless someone wants to do what Suneth did and use our Swing SDK to write a desktop blog editor, there’s very little chance you’ll ever see EditLive! in one.


Still, my point stands. Try a real HTML editor before writing them all off as useless. Although if you try it and think something is wrong, please don’t be afraid to tell us πŸ™‚

Having posted about my love of the Phoenix Wright series back in September last year, I was surprised when a few days ago I discovered that the english release of the fourth iteration (Ace Attorney: Apollo Justice) was due out in a few weeks and I hadn’t noticed.  I think the marketing for the game is only just starting to ramp up, with pointed release date announcements and a new dev blog.

I also had a nice surprise when ordering it from dvdboxoffice – my source for importing games that will take months to come out here, if they ever do – I had a birthday coupon code from last year that I’d forgotten about and gave me $2.50 off the order πŸ˜€


Speaking of games that aren’t scheduled for release in Australia though (did I mention I love that DS games aren’t region locked?), the other game I’ve been keeping an eye on is Professor Layton and the Curious Village.  In the last couple of weeks Wired has had coverage of both the official trailer and this cool magazine ad showing off the quality of puzzles featured in the game.  It is due out in just over a week so I ordered that to tide me over until Apollo Justice (free shipping ftw!)


On a final note that could be a new entry but isn’t really worth it, this blog has been quiet because I’ve been hard at work on the next release of EditLive! and haven’t had much to talk about.  That isn’t likely to change for at least another week or two πŸ™‚

So Suneth seems to be enjoying his visit to our US office, and it works both ways. He’s been teaching them how to handle the simple support cases and giving me less work to do! (which incidentally makes training Dylan quite a bit easier).

What caught my eye though was this quote at the end:

Working for Ephox pretty much summarizes my definition of a perfect job.

I’ve felt that way ever since… oh, around the time they started paying me for this stuff πŸ˜€

It’s nice to know I’m not the only one, and I think this is one of the reasons our team works so well together – we all enjoy the job so much that we want to turn up in the morning πŸ˜‰

Next Page »