Weeknotes 2024 W45: Open
Quick bits:
-
I was not prepared for the King in Orange to win. I am still processing that disaster. I have nothing useful or insightful to say at this point except fuck.
-
November 9th is a confusing date every year in Germany. On one hand, it is the anniversary of the fall of the Berlin Wall and a step towards the end of communist authoritarianism. On the other hand, it is the anniversary of the November pogroms,1 a step towards the Holocaust. Never again.
-
The reading time indicator on my web site (used for articles) now has a rough estimate rounded to the nearest 5 minutes. This is makes more sense than having a more accurate reading time estimate. (The reading time in minutes is the number of words divided by 200.)
-
The macOS Shortcuts app continues to be unreliable. Executing a shortcut for the first time does nothing. The second time, it does what it is supposed to do, but it never terminates: the “running” indicator remains there.
-
It is time for me to come clean. I am, in fact, Satoshi Nakamoto.
Shower thoughts:
-
The plural of “medium rare” (as in steak) is “media rare” (as in NFTs). This is one of the many reasons why I am a vegetarian.
-
A heated conversation about salad followed by sorrow is called an arugulament.
I am in the process of writing an article titled “The intricacies of implementing memoization in Ruby.”
I’m making good progress on it. The first draft is nearing completion; I have maybe three hundred words left to write. I’m hoping for the article to be ready for publication coming weekend, but that is probably optimistic.
Are there good places (besides my personal blog) to publish articles related to Ruby?
This is the first time that I am writing an article with Scrivener rather than D★Mark. I’m rather pleased with the setup. But Scrivener is not perfect, and I keep thinking about better ways of writing.
I write my stuff in Markdown in Scrivener, and it feels just a little awkward. I use Scrivener styles for marking up pieces of text,2 but the abstraction is leaky: being able to use Scrivener styles and raw Markdown markup sometimes leads to incorrect Markdown and missing escape sequences.
I also think that Markdown itself is inadequate as a format for technical writing. It’s better in some Markdown dialects (like pandoc’s) but then there’s the issue of Markdown dialects not being portable. Purely from a markup perspective, I much prefer D★Mark.
Once again, I am thinking about writing my own editor. I greatly value semantic markup, so I’d love to have a way to mark up text, whether fiction or non-fiction, as a node graph that can be translated into various formats like Markdown, HTML, (La)TeX, and DocBook. In many ways, this is why I created D★Mark.
Perhaps it is time to experiment with ProseMirror and try to whip up a prototype. I think it’d be neat to have an editor for a D★Mark-like markup language with a visual representation, not unlike how Bear uses markup that gets automatically hidden. In any case, onto the Ideas page it goes.
I quite like Lu Wilson’s talk What it means to be open given at Heart of Clojure 2024.
I like working in the open. I already do that to an extent: my weeknotes are a prime example of that.
But there is also a lot that I work on behind closed doors:
-
The non-fiction book I am writing, Writing an Interpreter in Ruby, is not publicly available. Publishers will want first rights,3 so self-publishing a work-in-progress draft is not smart. In any case, I need to get the book to a more finished state before I can share it.
-
My personal web site is closed source, for two reasons. First, the Git commit history has private information that I do not want to share. There is stuff that I committed by accident and have reverted. Keeping a clean public repository is much harder than a private one where I can do whatever I want.
Secondly, I want to be able to remove or replaced outdated stuff. I change and grow as a person, and some old content very much no longer deserves to be online. The first commit in the Git repository for my web site is from 2007,4 and I am a much better person than 17 years ago.
-
Various tools I’ve written are not publicly accessible. At first, I felt that it makes no sense for these tools to be public because they are too niche (e.g. my manuscript compiler is not going to be useful to many people beyond myself). But that’s not quite the real reason.
I keep many of my pieces of software private because I am anxious that once other people start using them, I’ll end up maintaining them for other people. I’ll have to look into issues handling, deal with pull requests, and doing support in general — and I’m not willing to take on more work of that kind.
I could publish software without offering any support. Publish and forget. Disable the Issues feature on GitHub, so that people can’t even report issues. But GitHub does not support disabling pull requests, which makes GitHub not ideal for a publish-and-forget approach. But I most likely am overly cautious.
Perhaps these pieces of software would be good to license under the Hippocratic License. Ethical source is more interesting and important to me than open source.
Still, I’d like to create more stuff in the open. I’d love to publish stuff that is woefully unfinished, feature-incomplete, buggy, undocumented, scrappy af. The biggest hurdle I am facing here is, most likely, a psychological one.
I hit a particularly weird bug in my Ruby code the other day. Take a look at the following:
p 100
p [100, 200]
p [100, 200, 300]
In Ruby, the #p
method debug-prints the given argument. (Parentheses are optional.) This, as you could expect, yields the following output:
100
[100, 200]
[100, 200, 300]
Everything is normal so far. But in my particular case, the output that I got was quite different from what I expected:
100
sample.rb:15:in `[]': wrong number of arguments (given 3, expected 1..2) (ArgumentError)
To clarify:
-
The first line debug-prints the argument as usual. (This is good and expected.)
-
The second line does nothing.
-
The third line throws a bizarre
ArgumentError
.
It turns out that this happens when p
is reassigned to a local variable, e.g. p = 300
. The second and third lines (with the square brackets) are then treated as calls to the #[]
method, i.e. p[100, 200]
and p[100, 200, 300]
, respectively. The first line is still treated as a method call to #p
.
So, p
is treated differently depending on the shape of the expression, and whether or not there is a (local) variable named p
.
This is easy to verify by looking at the parse tree.5 Here is the parse tree for p 100
:
s(:send, nil, :p,
s(:int, 100))
Nothing unusual: this calls #p
with the argument 100
.
Parsing p [100]
yields the following:
s(:send, nil, :p,
s(:array,
s(:int, 100)))
Also nothing unusual here: this calls #p
with the argument [100]
.
But it gets very different when first assigning a value to a local variable p
. Here is what p = 300; p [100]
parses as:
s(:begin,
s(:lvasgn, :p,
s(:int, 300)),
s(:send,
s(:lvar, :p), :[],
s(:int, 100)))
Despite having over 17 years of experience with Ruby, I had never bumped into a situation like this.6 Wild!
And yes, Integer#[]
can be called with one integer as an argument (a bit offset) or two arguments (a bit offset and a bit slice size). This is why p [100, 200]
did “nothing:” it didn’t print anything, but silently returned a slice of bits.
Entertainment:
-
Slow progress through the “The Final Draft” mode of Alan Wake II.7
-
I am struggling to find time to continue with We Have Always Lived In the Castle.8 I’ve probably overextended myself, time-wise, this week.
Tweets and toots:
Politics links:
-
Ten Free Ebooks for Getting Free: I haven’t read these (yet), but feels like worth sharing!
-
Shame on the Elon enablers (Paris Marx, Disconnect): Quote: “If you thought we were already living in a tech dystopia these past few years, it’s time to buckle up. You haven’t seen anything yet.” I fear this is true.
-
Our Fight, Our Hope — Not America’s Story (Jessie Gender): Worth watching after the recent political disaster.
-
How To Be Hopeless (Carlos Maza): Also worth watching (or re-watching) for the same reason.
-
The Corruption of Open Source (Paris Marx with guest tante, Tech Won’t Save Us podcast)
Entertainment links:
-
Games That Hide Their Own Sequels (Jacob Geller)
-
Peggle Might Be Too Pure For 2024 (Jacob Geller, Nebula): Peggle was one fantastic game for the reasons Geller puts out. (I have a copy of the game somewhere… but I can’t find it anymore!)
Silly links:
- Unparalleled Misalignments (Ricki Heicklen)
Tech links:
-
New CSS that can actually be used in 2024 (Thomasorus)
-
Plain Text Editor (Sindre Sorhus): So neat. I might test-drive this alongside iWriter Pro for a while.
-
Windows Server 2025 takes admins by surprise: Not satire.
Miscellaneous inks:
-
How Self-Driving Cars will Destroy Cities (Not Just Bikes, on Nebula): What an interesting perspective! I share the sentiment that self-driving cars will cause more harm than good.
-
“J’ai fait une erreur”: Danny, le dessinateur de “Spirou et la Gorgone bleue” réagit à la polémique (in French; content warning for racist depictions in comic books): Yikes. Astounding that a casual throwback to colonialism happened with nobody involved saying that perhaps this is plain terrible.
-
Better known as Kristallnacht (lit. “crystal night”) which is a term I don’t like: it is a euphemism (it’s not about the glass!) and misleading because the November pogroms happened during daylight too. ↩︎
-
I wrote about this in Weeknotes 2024 W41: Acquired taste. ↩︎
-
This definitely applies to fiction. It might not apply to non-fiction, but I assume it does. I couldn’t find much about that; does anyone have experience here? ↩︎
-
Back then, it was still a Subversion repository. Later, it got converted into a Mercurial repository, and finally converted into a Git repository. The repository predates the existence of GitHub, even. My web site existed even before that. It’s been a ride! ↩︎
-
I am using whitequark/parser but this works just as well with Prism, too. ↩︎
-
It has also never occurred to me to define a local variable named
p
. After all, doing that would prevent me from usingp
as a debug-print method. ↩︎ -
Alan Wake II (Remedy Entertainment, 2023), published by Epic Games Publishing. ↩︎
-
Shirley Jackson, We have always lived in the castle (London: Penguin, 2009). ↩︎