Technical Blog

Warp Factor Refactoring in Emacs

1 Jun 2023

Here’s a nifty Emacs workflow for doing a project-wide search-and-replace on steroids. While I do use refactor tools that come with language servers,1 sometimes those aren’t enough. Consider the case where you not only need to change the name of a function, but also e.g. need to swap the order of two of its arguments. Or you’ve broken one function out into two that need to be chained together. Whatever—there are plenty of ways where the IDE won’t be able to do everything that you need. Enter: Emacs.

...

Writing Racket Macros: define-syntax and phases

19 May 2023

There are a bunch of different ways of writing a macro in Racket. There are also some tricky things around phases to keep in mind. This is to help me keep them all straight.

3+1 ways to make a macro #

This form:

(define-syntax-rule (foo args ...) (use args ...))

is equivalent to:

(define-syntax foo
  (syntax-rules ()
    ([foo args ...] (use args ...))))

Which, is in turn equivalent to:

(define-syntax foo
  (λ (stx)
    (syntax-case stx ()
      [(gensymed-foo args ...) #'(use args ...)])))  ; gensymed-foo is like foo but doesn't match in the template

because syntax-rules expands to syntax-case with some fancy wrapping around it.

...

Meta: Update should fix RSS feeds

13 May 2023

I recently made an update to how I build my blog. I like writing my posts with Org-mode because it provides a richer markup language than Markdown. Plus, more Emacs = more good. Hugo has support for Org files, but there was a problem with the RSS feed generation: all of my posts written in Org got truncated at some point. I don’t know if the fault lies with Hugo itself or with some problem in the theme I use—whatever it was, I don’t have the time right now to debug that and submit a good bug report or a fix. Instead, I’m using the ox-hugo org-mode exporter, so I still can write my posts with Org, but then let Emacs export them to Markdown for Hugo to process.

...

The kind of thinking computer science enables

11 May 2023

I believe computer science plays as integral of a part to a well-rounded liberal arts education as does mathematics and linguistics. Why? A liberal arts education is designed to help you think in new and better ways. Computer science teaches novel ways of thinking, reasoning, and approaching problems that are hard to get anywhere else.

I took a class on pedagogy when I encountered this puzzle. I answered the question easily, and I caught myself using reasoning patterns from work in programming coming to the forefront.

...

Using a Real Mail Client with Outlook

3 May 2023

I recently managed to get access to my Outlook email from Emacs. This took some doing as my university had disabled app passwords. I consider Outlook to be harmful, but inasmuch as companies and schools continue to enforce OAUTH-only authentication with email systems, it is good to find workarounds.

This is how I set up email sending/receiving on my computer running macOS with DavMail. I also use mbsync (confusingly also known as isync) to actually fetch my email, and mu/mu4e to index and read mail. Douglas Rumbaugh has an awesome blog post that I followed to get this working. You should read that. This will mostly be my specific configuration settings as well as some tips and tricks.

...

Praise for the pragmatic third camp

16 Mar 2023

Some years ago I came across a blog post that described programmers as being in one of three camps. It's a fun, short post, so I encourage you to go read that real quick, but the gist of it is that programmers generally fall into one of three categories according to what they primarily value:

  1. Applied mathematicians, who appreciate elegant solutions to problems. Program execution on von Neumann machines is incidental. These programmers like high-level languages and mathematically correct reasoning about programs.
  2. Bit hackers, who like making the machine run as efficiently as possible. Without a von Neumann machine, programs are pointless. These programmers like low-level languages that let them get into the guts of things.
  3. Product makers, who care about the ideals of the first and second camps in as much as they help them accomplish the task of delivering more features. Most industry programmers probably fall into this category. They like high-level languages as long as performance doesn't suffer too much and that it's pragmatic. (E.g. JavaScript, Ruby, Python, Go, etc.)

The author of the post talks a little bit about the tension between the camps. I won't reproduce it here, but it can be amusing, so you should give it a read.

...

Metric Worship, or: How a bad manager wrecked a (small) company

21 Feb 2023

The story

I once worked as a part of a company with four employees, all of us programmers. We formed a sort of daughter company with a bigger—though still modest-sized—company that handled our payroll and whatnot. Our work directly helped the parent company, but we were organizationally independent development-wise. I really liked working with that small team: we had a one-hour meeting each week to plan out our work, and a short, casual stand-up each morning to get things rolling. Almost all my time was spent building features and squishing bugs. I got a lot of really good feedback on all my pull-requests, as everyone there really cared about making a good-quality product.

...

What is a type system, really?

23 Jan 2023

Background #

This is a question I’ve been wrestling with for a little bit. My first experience with a type system was with Java, and I didn’t like it. It just felt like an annoying constraint on the kinds of programs I could write. I was coming from Perl, which sports weak dynamic typing, so Java’s rigidity came as a bit of a shock.

After Java I learned some C, which too has types. C’s types are different from Java’s in a big way: in C they’re really just directives to the compiler on how to interpret some bytes. “Everything is just void *” is kind of true. In C, bytes can be interpreted however you wish.

...

Make an Emacs Buffer Open the Way You Want

27 Dec 2022

Are you tired of having a particular buffer pop open in the wrong direction? Do you wish, for example, that the Racket REPL buffer showed up on the right in a vertical split, rather than below in a horizontal one? Look no further. I give you, display-buffer-alist:

  (add-to-list 'display-buffer-alist
               '("\\*Racket REPL </>\\*"
                 (display-buffer-in-direction)
                 (direction . right)))

That little snippet will make sure when you hit C-c C-k inside of a racket-mode buffer, a REPL will pop up on the right-side instead of on the bottom. I find that much more comfortable to use.

...

What I Like in a Font for Code

5 Dec 2022

I'm well aware that I may have a bit of an obsession with fonts. I don't think that's too unusual for someone who works in tech, however. Sites like Programming Fonts exist to let people test drive and compare a bunch of different fonts. Just for fun, I thought I'd write up some of the features I look for in a programming font that I've come to deliberately pick out.

Critical letter forms: i, I, l, 1; o, O, 0

These are probably the most important letters to get write in any font that's meant to be hyper-legible: lowercase l must be easily distinguishable from an uppercase I or the number 1, and the lowercase i should stand out nicely as well.

...

Mastodon