Week of 2 November, 2020

  • Biden won! This is great news not just for America, but the entire world. It’s a ray of hope for those of us who have been disillusioned the democratic process in recent years.
  • Now if only we could get rid of our own knock-off version of the Orange Man. Sadly, we have to endure until 2024 before we get a chance to vote him out.
  • In more good news, I finished the first part of Crafting Interpreters! I used Python for my implementation, which you can find here. Next step: do it all over again in Rust 🦀
  • The medication I was initially prescribed for anxiety had been working well for me until three weeks ago, when it inexplicably started giving me brain fog and putting me to sleep for most of the day. I was put a different medication last week, and this one makes me wired. Fun. Funfunfun.
  • Since I wrote my last weeknote, I’ve really gotten into Emacs. Like, really really really gotten into Emacs. Besides programming, I’m now using it to read RSS, take notes, keep a journal, manage files, and read email. I’ll maybe possibly probably write a longer post about this later.
  • Even though this has been a terrible year for musicians, a surprisingly large number of good albums were still released. My favorites so far are RTJ4, SAWAYAMA, how i’m feeling now, Saint Cloud, BOSS, and Ultra Mono. There’s still a few weeks to go before the end of the year, so I’ll probably end up expanding this list pretty soon.

Week of 20 April, 2020

  • Anxiety was bad this week. I was up until 3AM on Tuesday night because I couldn’t turn off my brain, no matter how much I tried. I don’t know what triggered it, but getting off social media and news websites seems to have fixed it.
  • I’ve started spending a bit of time each morning reading short stories in Punjabi. I no longer struggle with the grammar or the script — I’ve already been reading the news in Punjabi for a few months — but a lot of the words are new to me. Having to constantly look up words slows me down, but I’m building a lot of vocabulary very fast.
  • I’ve given in and ordered a Roomba for the house.
  • Our girl kitten turned out to be a boy kitten, which explains the constant fights. The older cat doesn’t like this new roommate at all.
  • Not much progress with Crafting Interpreters this week, but I did add a way to convert an AST into a Graphviz diagram. Very proud of this one.

The Expression Problem

While reading Crafting Interpreters, I learned about something called the expression problem. It’s a problem I’ve run into countless times, especially in larger projects, but I never knew it had an actual name. As usual, Eli Bendersky has an in-depth article about the problem and its solution in C++ and Clojure.

After reading Eli’s article, I wondered how the problem would manifest in Rust and what the solution would be. Turns out it’s not too complicated. Want to add a new type? Just add it and implement all the traits you care about. Want to add a new operation? Define a new trait and implement it on all the types you care about. This article goes into more detail on what that looks like.

People Sure Have Opinions About Programming Languages

tl;dr: everyone loves pattern matching.