0036: typescript, papers, books

Published 2023-05-29

Taking it easy this month.


I'm trying to clean up the mess of bash/python/clojure/julia/rust scripts/apps/glue that I've accumulated. Javascript seems like the most obvious candidate to consolidate on, with fast startup, big ecosystem and gradual typing.

I went through most of the javascript and typescript courses on Execute Program. The interface is slick and the spaced repetition format seems effective. It's definitely aiming to be a standalone course though, which totally makes sense in terms of audience targetting but meant that the pacing was pretty tedious for me. I would have liked the option to skip reviews, but it was worthwhile even with the slow pace just to get a thorough explanation of all js/ts quirks and how to avoid or work around them.

I tried porting a little webapp to typescript.

I started out with deno which has a really nice out-of-the-box experience. The actual coding went fine. Modern js is still quirky but notably less gross than when I first learned (although I still don't know how to sanely handle maps with compound keys). But when I tried to deploy the new version I found out that while the deno runtime supports importing npm modules, it's bundling and deployment tools do not. And while searching through the issues I saw a lot more compatibility-related issues that made me nervous about continuing with deno.

So I tried nodejs and tsc instead. It took me several hours to get my code to compile and generate an output file than can run in js - something related to the several different javascript module systems, solved by several config changes in different places that I don't understand. And then I had to rewrite everything that was using deno apis to the slightly different node.js apis. And then (possibly because of my module settings?) I'm no longer allowed to use top-level async, so I had to reorganize all the code inside a giant (async function() { ... })(). And then there are still some remaining bugs that I ran out of steam to deal with.

Not to mention that when I just wanted to spit out some html the idiomatic solution seems to be a whole extra preprocessor which needs a bunch of build-time configuration and decisions on which runtime library to forward it to and ... no way am I messing with the build again today.

So that took a whole afternoon and I didn't even end up with a working port. I'm sure much of this is just learning curve, but it still feels like a lot of complexity and debugging when I just want some low-maintenance glue.

Are there better options? Python packaging is also kind of a mess. Julia is nice as a language, but very slow startup makes it unusable for scripting. Go? Lua? I just want to script linux stuff and talk to http apis and make some mostly-plain-html webapps that talk to sqlite, without having to constantly fix bitrot and maintain virutal environments.


Implementation strategies for mutable value semantics. I think this is the work that lead to Val. The core idea is that different variables never (observably) alias. Introduces a toy language with just enough features to discuss how to implement this idea efficiently via a few key optimizations. I'm slowly working through an implementation of this language to make sure I really understand it.

In my work on blurring programming languages and query languages one of the key sticking points is that query languages typically rely on explicit ids to link data, rather than accumulating fields in a heap location and passing around a pointer to that location, and it's not obvious how to combine that style of programming with the pointer-and-nesting-based models of abstraction and composition used in programming languages. Also the possibility of aliasing makes almost all query optimizations impossible. So it's really interesting to see this totally parallel line of research into programming without aliasing and to start thinking about how this might play into query-style optimizations.


It doesn't have to be crazy at work. I listened to this as an audiobook so I didn't take any notes. The main thing that stuck in my mind was avoiding deadlines whenever possible eg never publicly discussing features or launches so that they don't feel any pressure to be self-consistent.

Make your bed. A bunch of aphorisms. Uninteresting.

Plays well with others. Generic pop sci.

The comfort crisis. The core idea - that it's important to actively expand your comfort zone by regularly venturing outside it - is explained much better elsewhere eg various modern retellings of stoic texts. But if you delete all the pop sci chapters and just read the author's story of using physical hardship to treat his alcoholism, it's entertaining enough.

How caffeine created the modern world. Entertaining, full of fun tidbits. Eg bees get addicted to the nectar of caffeinated plants and visit them more often than is optimal for the bees, which probably explains why caffeine exists.

Quit. Definitely contributed to quitting my job. I'm not sure whether this is a great book or whether I just happened to read it at a very appropriate time. None of the ideas were new to me but reading a chapter every morning gave me a regular nudge to actually apply the exercises, which is always the hardest step. Maybe think of it less as a book and more as a flowchart to reach for when making a decision?

Joyful. Filled with pop sci fluff (I wish this style wasn't so popular) but some fun ideas in the gaps. We carpeted our entire environment in boxes painted beige and brown - it's refreshing to see anyone acknowledge that this is depressing as hell and we should paint things.

The antidote. More repackaged stoicism.

KLF. Fun as hell. Not only is the underlying story wild, but the author takes the core themes to heart and constantly threatens to be lying about any given fact, and breaks up the narrative with questioning whether you should accept any narrative at all about a cluster of random events.

It can absorb any attack, no matter how heartfelt, because it simply doesn't care about anything except the bottom line. As the Situationists put it, "opposition to the spectacle can produce only the spectacle of opposition."

As we cannot escape from this onslaught, the Situationists argued, our only honourable response is to fuck with it.

...you have the right to do what you like with whatever culture is thrust at you...

The art of procrastination. The author once had a popular blog post and probably should have stopped there.

Conversations with people who hate me. The author runs a podcast where he talks to people who have sent him hate mail, not to fight them but with curiosity and empathy. Most of the interviewees are civil and apologetic when faced with actual conversation rather than debate, and some later went on to soften their views on the contentious issue. It shouldn't be surprising that if you want to persuade someone to change their beliefs that the first step has to be understanding where their current beliefs come from, but somehow that's become anathema to all sides in most of western civilization. It's really notable that the author feels the need to defend their actions, questioning whether he's committed ideological treason by having a civil conversation with someone he disagress with, and whether he's even allowed to say that talking to people is a good idea if not everyone has the capacity or safety to do so. I hope this book is widely read.

Lost connections. Overly simplistic and really damaged by the need to put a strong narrative on the subject - presenting what is more or less current consensus as outsider giant-slaying. I want to like the book for tackling this subject at all, but it's just not there. I'm currently reading The globalization of addiction which so far seems somewhat more thoughtful and less showy.