Merry Christmas
It's nearly Christmas. In fact, my family is pretending that Sunday is Christmas day, for scheduling reasons. This'll be the last Skill Issue until 2025. I'm taking the next couple of weeks to recharge.
Advent of Code
I got through twelve days of Advent of Code this year, but I've just got too much stuff going on in the rest of my life to close it out. I'm resume doing some streams in the new year though, because I'd love to finish the puzzles.
Day 12 was an important puzzle though, because I was able to eval
the input and put my entire solution inside of const_missing
. You can watch it in all its glory here.
Flipping the ReScript
I don't hate writing JavaScript/TypeScript, but I don't love it either. I'm in the Anti JavaScript JavaScript Club. I enjoy writing it, but generally think we should write as little of it as possible. There's some nuance lost in that statement, but that's a topic for another day.
I love writing ReScript, though. I wish I could write everything in ReScript. Writing ReScript code brings me joy.
If this means anything to you, PureScript (and to a lesser extent, Elm) is to Haskell what ReScript is to OCaml. You're writing something vaguely like OCaml that compiles to (relatively clean) JavaScript.
Here's a quick list of the things I love about ReScript:
- It gives you a safer (and sound) type system than TypeScript without needing tons of type annotations.
- You can integrate with existing JavaScript code easily. The glue code you write "compiles away", so your compiled code just contains bare function calls to the external code.
- The compiler is fast as hell. Get wrecked, TypeScript.
- The type system/compiler provide helpful errors that often point to real bugs.
- You can adopt it incrementally.
- The language is actively developed and continues to ship new, useful functionality.
- The syntax is nice.
There are two big knocks against the language, though. The first is that no one uses it. Good luck finding helpful tutorials and resources. They have a forum that's full of good stuff, but you'll find you're on your own when you start searching for code examples.
The second knock is that there's a bit of a learning curve. The language is significantly simpler and more restrictive than JavaScript/TypeScript. You're going to try to do things and find you aren't allowed to do them in ReScript. It's for the best, but it's frustrating at first.
TypeScript was created to allow you to type all the crazy things people do in JavaScript. That's very useful. I like that about TypeScript. ReScript takes a different approach. It doesn't allow you to do crazy things. It pushes you towards simple, functional approaches to your problems.
Using ReScript isn't all that risky, either, because it's designed to be ejected from projects. If you add it to a project and later decide that was a mistake, we're not locked in. Because ReScript compiles to normal-looking JavaScript, you can un-ignore the compiled modules, commit them to your VCS, and remove the ReScript.
I've been writing all my side projects in ReScript for a couple of years now and I'm sold on the technology. I don't put it in our client projects, because I'm not burdening our clients' developers with learning new languages, but for everything else I love it.
Master of the Games
I was recommended an album by a barista at a local coffee shop (who has good taste in music), so I'll pass it on. Detroit-based heavy metal band Demon Bitch dropped Master of the Games at the end of November and it's a blast. A little on the chaotic side, but a damn good time.