Weeknotes 182
Niche operation
-
We’re halfway through 2023. I haven’t done anything yet.
-
Only joking. I literally did some things this week. Ufuk was in town so I had the rare treat of meeting him for beers in De Beauvoir Town on Monday and Tuesday nights like some kind of bon vivant, and I had breakfast with friends in Shoreditch on Thursday when Alice was staying nearby. Good times.
-
The Silo season finale was alright but didn’t meaningfully increase the pace. I can’t believe it was all a dream! It felt a bit derivative to have Tim Robbins tunnel his way out of the silo and emerge in the rain! and so on
In hindsight I reluctantly admit I enjoyed the first season despite its languid storytelling, muted visuals and occasionally very weird performances. It was consistently watchable even though it never got half as good as For All Mankind or Severance. The mild cliffhanger means I’ll probably be curious enough to watch season two by the time it arrives.
-
In other Apple TV+ news I watched the first two episodes of Hijack Bauer, a real-time thriller starring Idris Elba as a man who’s always calm and angry at the same time (“that’s my secret, aeroplane captain”).
It’s not as bad as I expected! It’s actually pretty entertaining and they’ve been able to make it feel convincingly British without also filming it in that horrible Holby City-o-vision which plagues Dr Who and similar. I expect it to get increasingly silly as it goes on.
-
I tried to watch Secret Invasion but, amazingly, the “AI-generated” title sequence isn’t even the laziest part.
-
There’s been a bit of movement on last week’s
RUBYOPT
question: Aaron spotted that Matz originally said the backtrace limit should be settable throughRUBYOPT
, which is good enough for me, so I submitted a patch. 🤞🏻I’d like to clean up the documentation of which command-line options are supported by
RUBYOPT
becauseman ruby
is hopelessly out of date, but I’ll save that for a dedicated bunfight once--backtrace-limit
is fixed. -
I got a bit more work done — although not as much as I’d hoped — on my WebAssembly interpreter. At first I made decent progress on clearing out some of my laptop’s backlog onto GitHub:
-
I added support for data segment abbreviations to the preprocessor. This was much less fiddly than the equivalent work for element segments because data segments only support a couple of simple abbreviations which don’t interact with each other.
-
I also added support for inline data segments in memory definitions. This involved extracting some pieces of the parser so they could be shared with the preprocessor but otherwise was pleasingly straightforward thanks to its similarity to my previous work on inline element segments.
-
Turns out several people do read this bit! Thank you for either caring about the mudane details of my life or being an obsessive weeknotes completionist, both of which I appreciate by exactly the same amount.
-
I did a little refactoring to introduce AST nodes that explicitly represent the modes of element & data segments. It’s a small change but it makes the code easier to understand.
Again, it’s satisfying to see the parser growing steadily shorter & simpler as the preprocessor’s implementation and test suite grow longer.
-
-
Progress stalled when I got hung up on debugging a mysterious CI failure. It turned out to be a bug in YJIT that Alan quickly fixed, for which I’m very grateful. I’m already running a patched version locally and I’m hoping the fix will get into 3.3.0-preview2 so I can rely on it in CI too.
Although getting caught out by a bug isn’t ideal, I find it comforting that my (otherwise inherently pointless) work is indirectly generating fixes for other projects regardless of whether I eventually release anything useful.
-
It’s not too surprising this bug slipped through the net; after all, destructuring an array for assignment to multiple optional block parameters is a pretty niche operation. But it’s an idiom I use whenever I want to unzip an array of tuples with
#transpose
…[[1, :a], [2, :b]].transpose.then do |numbers, symbols| # numbers is [1, 2], symbols is [:a, :b] end
…because of how
#transpose
behaves when the original array is empty:[].transpose.then do |numbers, symbols| # numbers is nil, symbols is nil end
What we want in this case is for all of the unzipped arrays to be empty. Unfortunately there’s no way for
#transpose
to know the intended arity of the tuples in the original array (because there aren’t any) so it returns an empty array and our block receives allnil
s instead. That can cause problems if the block goes on to process its presumed array arguments with operations like#map
or#inject
or whatever.We could work around this by coercing the
nil
s into empty arrays with#to_a
orKernel#Array
before we use them, but I prefer to handle it inline by providing defaults for the block parameters:[].transpose.then do |numbers = [], symbols = []| # numbers is [], symbols is [] end
I think this is nicer because a) it’s concise and b) it more strongly communicates the idea that the block arguments default to the empty array if they’re missing. Am I the only person who does this?
-
Anyway, the galaxy brain solution is for
#transpose
to take an optionalsize
argument to address this edge case, like the optional initial value for#inject
and#sum
. Someone made a similar complaint in 2012 so maybe enough time has passed for it to be worth trying again. -
An unexpected consequence of my
--update-refs
adoption is that I now find myself updating potentially many remote branches when Igit push --all
after a rebase, which in turn triggers potentially many GitHub Actions runs.For the first time ever I used a significant fraction of my 2,000 free monthly minutes: in June I ran jobs for an unprecedented 689 minutes, including 146 minutes spent on one glorious day alone. I suppose this is still a long way from being an actual problem but it does mean I’ve started keeping an eye on my usage of a resource that’s always felt practically unlimited.
-
I went to the physio and saw a poster advertising the hospital’s values: “safe”, “personal”, “respectful” and “responsibility”. I’m not convinced the benefit of the physio has offset the psychic pain of three adjectives and a noun.
-
I don’t miss Twitter. Coincidentally Apollo stopped working this week, so I suppose that’s Reddit gone too.