Started to sketch out the parsing example with the left-fold postorder consumer design. I haven't had the time to write tests yet, but hey it passes the type checker. Figured I'd post up the WIP and I'll finish it off tomorrow.
https://gist.github.com/pervognsen/cf7f77a66e614fc4b32858e78918fdf5
AI doomerism from 1863!
https://newsletter.pessimistsarchive.org/p/a-warning-about-ai-from-1863
Great example of how closure-based APIs are inherently safer than RAII-based APIs: https://cliffle.com/blog/lilos-cancel-safety/. This is famously true for Rust threads and I've also found it true for transactions.
Just realized in the shower that Euclid's algorithm is kind of trivial if you think about it a) geometrically and b) recursively. Geometrically, the GCD problem becomes "given a rectangle with sides of integer length, what is the largest square with integer side that tiles the given rectangle?". Recursively, if you tile the rectangle with squares with sides equal to the rectangle's smaller side, the remaining rectangle either vanishes, in which case we are done, or the solution for the remaining rectangle is also the solution for the original rectangle (easy to verify). We know the algorithm terminates because the square with side 1 tiles any rectangle. This recursive algorithm is pretty straightforward to transform into the familiar iterative algorithm.
The PR is up for how we're thinking about complete-but-not-sound type systems...
https://github.com/Roblox/luau/pull/1037
I wish I had more time to be more seriously interested in what I call "hyperconnected" data structures. Those are data structures which are at least tree-like, but which are also wired up by extra pointer threads supporting rapid access patterns. Lists where you know the last cell are an example, as are doubly-linked lists. Gnarly invariants badly maintained, and sustainable only when managing uniqueness of ownership.
In my mind, there are red pointers, which characterise tree-like structures and obey a strictly linear discipline, but there are also black pointers, which give you short cuts into lumps of data for which you hold the red pointers. The logic that's needed should tell you, given which red pointers you own, which black pointers you also have.
Hello you fine Internet Folks,
Today's article is some more Hot Chips coverage but with a bit of a curve ball tossed in there; we have covered Zen 4's uarch before so today we are looking at where Zen 4's bottlenecks in 2 games are.
Hope y'all enjoy!
https://chipsandcheese.com/2023/09/06/hot-chips-2023-characterizing-gaming-workloads-on-zen-4/
Breaking news: they finally found the artist who did the cover for _A Wrinkle In Time_; his name was Richard Bober. https://www.wbur.org/endlessthread/2023/09/01/artist-known-wrinkle
All I want is a business-class 16" laptop with a mobile Zen 4 CPU, 64GB RAM, and a resolution larger than 1920 but not dramatically so.
HP and Lenovo conspire against me. They have 2560x1600 screen options for Intel versions; for previous generation versions; even for 14" versions! But for current generation 16" AMD *specifically*, they don't. And so, sadly, I toot this toot.
I still don't understand why free variables are called "free" variables. No variable is ever really free, no? It is just bound in a non-local context, and different decisions can be made at the language level about what that means. It doesn't have any meaning to consider a term outside of its context.
New blog post! This one, on (software) systems operating at or beyond their capacity, what goes wrong, and how to degrade gracefully.
I've been diving into runtime systems and low-level stuff recently. Here's a "blogpost" about garbage collection which has zero cost when we don't run garbage collection.
https://gist.github.com/AndrasKovacs/fc9e20b0976b7e236b5899fde8f5c95d
I feel that there's a bit of a connection to type theory here. Let me summarize shortly. When we compile down to C and want to have copying GC, one problem is that C believes that every function call invalidates the whole memory (because GC can write memory). LLVM fares slightly better; it believes that every function call invalidates every heap pointer in scope and actually wants us to mark all of these invalidations in the IR.
In an IR designed with copying GC in mind, we would just want everything to be invariant under relocation, and then we don't even have to care about relocation or represent it in the IR at all. We just have to make sure that relocation is able to relocate GC roots absolutely everywhere (including registers).
The "relocation hell" in C and LLVM is similar to "hell" in type theory, like setoid hell or groupoid hell. We want to work in a language where everything is implicitly well-behaved, not in a language where good behavior has to be manually enforced at every step.
Slightly adjacent to last toot (and earlier but slightly obscure reference to same subject): I recently read-in-detail the design papers around the Snuffle/Salsa/ChaCha series of stream ciphers (which are used basically everywhere now, and are also used ubiquitously as pseudorandom number generators) and I was surprised to learn that all of its cool properties (speed, simplicity, seekability/statelessness) derive from it actually .. being a hash!
It's just a (strong) hash of the stream key, some fixed data, and a counter -- the position you want in the stream. That produces a pseudorandom number stream, and to make that into a stream cipher you xor its output with the plaintext.
It was actually built as a _political argument_ against export control restrictions on stream ciphers, arguing that if you allow export of secure hashes, you are already allowing export of stream ciphers.
I found this very gratifying to learn, as it reduces my mental catalogue of magic objects in computer science. I already knew hashes were magic, now I can merge that with the category I had put pseudorandom-number-generators-and-stream-ciphers in.
Let me tell you an important thing about nasty sectarian wars. You have to let everyone who was engaged in that nasty sectarian war say "Stop! I don't want to be in a nasty sectarian war any more.". You really have to let them do that. You might feel like saying "You hypocrite! You used to be engaged in the nasty sectarian war!", but you shouldn't, because what you're saying is "Start the war again! It's the only way to be consistent!".