Plurrrr

week 23, 2022

Best practices for inclusive CLIs

This began as a reply to another article by Lucas F. Costa; it lists practices to improve user-experience (UX) of command-line interfaces (CLIs). It comes from a good place, and has some good advice: I particularly like its advice on input-validation and understandable errors. Unfortunately, a number of its suggestions are problematic, particularly from an accessibility perspective.

Source: Best practices for inclusive CLIs, an article by Rohan Kumar.

Caches In Rust

In this post I’ll describe how to implement caches in Rust. It is inspired by two recent refactors I landed at nearcore (nearcore#6549, nearcore#6811). Based on that experience, it seems that implementing caches wrong is rather easy, and making a mistake there risks “spilling over”, and spoiling the overall architecture of the application a bit.

Source: Caches In Rust, an article by Aleksey Kladov.

The Y combinator in Go with generics

A few years ago I've written in some detail about the Y combinator, including implementations in Clojure and Python.

This short post is showing how to implement the Y combinator in Go using generics; in general, static typing makes the Y combinator somewhat less appealing, but I figured that generics will at least allow the implementation to be reasonably reusable. Not that this is useful in any real-world scenario, of course :-)

Source: The Y combinator in Go with generics, an article by Eli Bendersky.

Heretics of Dune

Leto Atreides, the God Emperor of Dune, is dead. In the fifteen hundred years since his passing, the Empire has fallen into ruin. The great Scattering saw millions abandon the crumbling civilization and spread out beyond the reaches of known space. The planet Arrakis—now called Rakis—has reverted to its desert climate, and its great sandworms are dying.

Now the Lost Ones are returning home in pursuit of power. And as these factions vie for control over the remnants of the Empire, a girl named Sheeana rises to prominence in the wastelands of Rakis, sending religious fervor throughout the galaxy. For she possesses the abilities of the Fremen sandriders—fulfilling a prophecy foretold by the late God Emperor....

In the evening I started in book 5 of the Dune Chronicles by Frank Herbert: Heretics of Dune.

Write HTML Right

Even with a lot of help from a good text editor, writing HTML can be a drag. Nice documents end up as tag-swamps with little bits of content perched atop hills of tabs. Editing them becomes a test of patience and we get sick at the thought of having to look at our once-loved text. It doesn't have to be like this! There's a lightweight, easygoing way to write HTML that's been around since the beginning of the web.

Source: Write HTML Right, an article by Aaron D. Parks.

Data Race Patterns in Go

We developed a system to detect data races at Uber using a dynamic data race detection technique. This system, over a period of six months, detected about 2,000 data races in our Go code base, of which our developers already fixed ~1,100 data races.

Source: Data Race Patterns in Go, an article by Milind Chabbi and Murali Krishna Ramanathan.

Free Guy (2021)

A bank teller discovers that he's actually an NPC inside a brutal, open world video game.

In the evening Adam and I watched Free Guy. I liked the movie and give it a 7 out of 10.

Get Things Done with Emacs

I've decided some weeks ago to (try to) adopt the method of David Allen named "Get Things Done" (GTD). A lot of people were giving very positive feedback about this method and there are a lot of related resources online, including several Emacs/org-mode setup. This helped me a lot to design my own setup since I did not read the book, but I found a nice summary:

  1. Capture anything that crosses your mind, nothing is too big or small.
  2. Clarify what you’ve captured into clear and concrete action steps.
  3. Organize and put everything into the right place.
  4. Review, update, and revise your lists.
  5. Engage Get to work on the important stuff.

Source: Get Things Done with Emacs, an article by Nicolas P. Rougier.

Rust without the async (hard) part

Last week two blog posts, titled Rust Is Hard, Or: The Misery of Mainstream Programming and (async) Rust doesn’t have to be hard, sparked a lot of discussions on Hacker News and Reddit.

This topic is close to my heart. After all, at lunatic we are building a Rust runtime with the performance characteristics of async Rust, but without the issues of async Rust. It brings Rust back to its pre-1.0 days when it still used user space threads as a concurrency model.

In this blog post I would like to compare both approaches and show the differences between the programming models and runtime characteristics.

Source: Rust without the async (hard) part, an article by Bernard Kolobara.

Pandas vectorization: faster code, slower code, bloated memory

When you’re processing data with Pandas, so-called “vectorized” operations can significantly speed up your code. Or at least, that’s the theory.

In practice, in some situations Pandas vectorized operations can actually make your code slower, or at least no faster. And they can also significantly increase memory usage.

Let’s dig in and see what vectorization means in Pandas, when and why it helps, and when it’s harmful.

Source: Pandas vectorization: faster code, slower code, bloated memory, an article by Itamar Turner-Trauring.

Beautiful Soup

You didn't write that awful page. You're just trying to get some data out of it. Beautiful Soup is here to help. Since 2004, it's been saving programmers hours or days of work on quick-turnaround screen scraping projects.

Beautiful Soup is a Python library designed for quick turnaround projects like screen-scraping.

Source: Beautiful Soup.

Why Emacs has Buffers

If you’re new to Emacs, you may wonder why you read and write text from buffers as opposed to, you know, files or documents. There’s the fact that it’s not skeuomorphic, and thus the term lacks the spark that connects it to a real-life concept. Most people have heard of files and documents in real life, and the term buffer is instead a capacious term with little grounding to most people.

Source: Why Emacs has Buffers, an article by Mickey Petersen.

Performance of coroutine-style lexers in Go

Back in 2011, Rob Pike gave a talk on the topic of Lexical Scanning in Go, where he presented an interesting approach to lexical analysis with coroutines (implemented via goroutines communicating over a channel). Since I've been pondering the connection between coroutines and state machines in the past, Rob's talk inspired me to try approximating this approach in Python using sub-generators.

Source: Performance of coroutine-style lexers in Go, an article by Eli Bendersky.

Unboxed types and primitive operations

GHC is built on a raft of primitive data types and operations; “primitive” in the sense that they cannot be defined in Haskell itself. While you really can use this stuff to write fast code, we generally find it a lot less painful, and more satisfying in the long run, to use higher-level language features and libraries. With any luck, the code you write will be optimised to the efficient unboxed version in any case. And if it isn’t, we’d like to know about it.

Source: 6.16 Unboxed types and primitive operations.