July 27th, 2024 07:59 UTC · 3 months ago

Elm

Things I like/dislike/want in Elm

You may know Elm. It is a simple, elegant programming language, with far fewer sharp edges than most other languages. As a tool it fits almost perfectly in my hand. I can come back to an Elm codebase a year or three later and rapidly be back up to speed; this is a commonly shared experience amongst the community.

It has limitations too which some bridle against, such as how it interoperates with JavaScript, but many of these constraints are what make the language so… it’s hard to express, but liberating might be somewhere close. Spend some time with Elm and you might see what I mean.

Then, as with anything, it has its problems. I could write for days on what’s good about Elm, but my list of gripes is brief. Some of these will be well known in the Elm community; most are more personal. I care about the future of Elm; if I didn’t care, I wouldn’t write.

Here goes:

  • I hate that shadowing is not allowed. This seems… patronising. I end up devising stupid (petulant?) naming schemes to work around it, like repeatedly appended underscores. When coding, even in Elm, one is frequently looking back to see where a name comes from, so why make it different when shadowing? It’s inconsistent anyway: I can shadow imported names for example.

  • The Elm Visual Studio Code plugin is fantastic – until it suddenly and inexplicably decides to stop working, with no apparent way to dislodge it from its broken state. I promise I’ve tried. I feel certain there’s a cache or database somewhere that if I could just delete, all would be right again, but I haven’t found it. Fortunately, the Elm Land plugin is an alternative. It has fewer features, but is reliable and fast.

  • I want to be able to deconstruct a record to split it up, e.g. I want to deconstruct {a, b, c} into c and {a, b}. Presently I have to construct {a, b} explicitly. To “break off” a field or two from a large object can be onerous.

  • There is an air of stagnation around the core tooling. There’s a plethora of useful packages and the community is thriving, and a lot of that is because Elm works – but one can see glimpses of a project that isn’t responsive to the users. For example, Zokka is a fork of the Elm compiler that hews closely to the original, but bundles accumulated bug fixes and wanted ergonomics around package management. It’s hard not to see it as born out of love for Elm, and yet also frustration.

I use Elm still. It has made me a better programmer, holistically. It’s my first choice for in-browser programming. A recent foray into React1 reminded me that I’m fortunate to use Elm, and I am grateful for it.

Frankly, Elm is beautiful and precious, and I hope I can use it for years to come.


1

For what it’s worth, I think React is fine, and kind of clever, but it’s hamstrung by JavaScript. When writing React code, coming from Elm, one sees bugs and the potential for bugs everywhere.