Gradual Epiphany

Erlang

I’ve taken an interest in Erlang of late. It’s a very pragmatic functional language that also has an excellent platform-style implementation. It has all the bells and whistles that you would ever want to build a really solid Jabber server.

One of the downsides to functional languages (from my limited experience) is that they tend to have relatively poor support for dealing with complex, tree-based data structures. In fact, the Erlang reference manual actually recommends doing any complex protocol termination/parsing code in C (or some other plug-in language). Based on this, I spend some time this evening looking at how to interface a C library with the Erlang VM. It turned out to be pretty straightforward, with the hardest part being the creation of a autoconf/make build system. Data can be passed back and forth from the Erlang VM in a synchronous or async manner; the VM also provides built-in thread pooling should your C code need to execute any long running code. You can tell that Erlang is a language/platform for getting stuff done, the documentation for interfacing with the VM is pretty good and extremely pragmatic.

I’m still adjusting to the functional viewpoint. Parts of it seem counter to modern thinking in the OOP world. Where OOP focuses on organizing operations around data, functional style seems to put the emphasis on deriving data from operations. It’s certainly a very different way of looking at the world. I haven’t yet decided if it’s more or less productive than OOP — the paradigm shift is just too big to determine that yet.