Elixir - Drinking the Kool-Aid
February 29, 2016
For the last few Januarys I've taken some time off from the day to day stuff to look a bit further afield, to do something new, code something in a language I've never used before, & have some fun. Sometimes something comes of it – the static site engine that powers this blog was a January Project – sometimes it's just ruling something out; but it's always useful, & a practice I can highly recommend to keep jadedness at bay.
This year my January project was Elixir, a language I'd heard a bit about, and for a brief unstructured while my January project grew into a sort of State of the Union of web development. Webdev is what I used to do for money and is something I still occasionally get to play at, and it's always nice to drink in the whole picture of what you do once in a while, to see if there's a better way of doing that thing. Spoiler: there isn't, not just yet. But there may be real soon.
At least for me. And the following is all just my opinion of course, your mileage may vary. This isn't an exercise in language shaming. People use languages for all sorts of reasons, because they're forced by their enterprise, or because it's easier for them than learning something new. You do what feels right for you. Though if you're using PHP on purpose, and I say this as someone who got paid to do that for years, if that's you: seek help.
This is a post to record how Elixir feels to me. Right now. Right at the beginning.
There's the usual hype around Elixir, helped along because it might solve the problems of a Pinterest scale operation, in the same way that Scala might solve some problems at Twitter scale, but there are reasons not to adopt it more generally. Yet. Yet.
Because Elixir really feels like it might be the next big thing, and I hate to say that because the last time I said it I was failing (& ultimately failed) to convince a company to convert its PHP codebase to the then brand-new Rails. They went out of business, I moved on.
Whatever concurrency Elixir offers comes at the cost of some clumsy syntax, this isn't just a matter of adding "go" in front of your function calls. Anonymous functions get called with a dot in front of them. Most of the structure of the language is really a series of clever macro tricks, so its potentially susceptible to Ruby's monkey patching madness. Data's immutable, but you can rebind different data to a variable that has the same name, with maybe only a warning at best about the original unused variable… yeah, that's not what immutable means. Yet… yet…
There's something. The bullet proofing of the thread management system… maybe. The individual parts aren't necessarily especially fast though, they're not Ruby slow, but there just hasn't been the time or the people power to write & fix stuff, so the libraries too are often still either written in Erlang or non existent… and Phoenix, the main (only? Let's say main, I'm not sure) web framework, has a honking great Node asset pipeline running through it… yet… yet…
The docs are great. It's easy to start. There's sometimes rambling about arity, sure. (Arity, you know, as in how many arguments a function has… no, me neither. Who talks like that? These guys are one drink away from talking about their monads.) But the docs are comprehensive. Dave Thomas who wrote the Pickaxe book has written an Elixir book too… Damn it, he was the one who got me started on Ruby last time.
There's something about it. And while not having the words to describe something might seem like a poor reason to write a blog post, I wanted to describe what this feels like, so I could come back to this moment in the years to come. After 21 years of doing this webdev thing, this is a feeling I get all too rarely. Long live the January project!