RSSAmplifier

Blog

Eric Holk

Articles about coding, making, and life.

theincredibleholk.orgRSS feed ↗10 posts

Latest posts

My Prompt from 1997

I'm feeling pretty vindicated on behalf of my fourteen-year-old self. Back in 1997, I was nerdy kid who loved computer games, programming, etc. To me the pinnacle of programming was to be a game programmer. I read books like The Black Art of 3D Game Programming and hung out on newsgroups like rec.games.programmer . 1 One day I came across a post entitled " The BEST Programming Language ." It posed…

Anonymous Impls

I often find myself writing a function that internally defines a struct just so I can implement a trait on it and return that type as an impl Trait . To see what I mean, let's look at a concrete example. We'll write a function that takes an iterator that yields, for example, 1, 2, 3, 4 and returns a new iterator that yields (1, 2), (3, 4). /// Assumes the input iterator yields an even number of…

Two Ways Not to Move

Lately I've been talking to a few people about whether it might be possible to replace the Pin wrapper in Rust with a new Move trait. Pin is one of those things that, while amazing that Rust can express the concept and semantics using just a library type, is not a lot of fun to use. This creates friction in building out Rust's async features because currently doing so increases the opportunities…

Some Rough Thoughts on Rust Project Organization

One of the big priorities for the Rust Leadership Council has been to determine the " shape of Rust ." For a long time I've wanted to write a comprehensive blog post about what I think the shape of Rust should look like. Unfortunately, I've had too many competing priorities to write something fully comprehensive. This post is not that post, but I did want to try to put down a couple ideas I've…

A Rose By Any Other Name

There are currently two competing designs for async iteration traits for Rust. The first is poll_next . The second is async fn next . I see strengths to each design. The poll_next design seems stronger on technical concerns, such as performance and ease of implementation. The async fn next design seems better from an ergonomics and consistency perspective. Unfortunately, the process of resolve…

Async Cancellation and Panic

When I last wrote about async cancellation in Rust, I touched briefly on the question of how cancellation interacts with panic. Mostly I left it as an exercise for the reader and left a rough sketch for how I thought it would work. More recently, Boats touched on the issue in a little more detail, but I think there are still a lot of open questions. In this post, I'd like to experiment with…

How to Shrink Rust

While doing some housekeeping on my blog over the weekend, I can across an ancient post by Patrick Walton. While I didn't realize it at the time, this post embodies what has become one of my core principles in program language design.[^spiky-blob] In re-reading Patrick's post, this quote stood out in particular: Language design tends to go in cycles: we grow the language to accommodate new…

Rethinking Rust's Function Declaration Syntax

We had a fun discussion in #t-lang about possible new syntax for declaring functions in Rust. There were a lot of cool ideas put forward, and while mulling them over I realized a lot of them work nicely together and can be introduced in a backwards-compatible way to give us some cool new capabilities. While these were fresh in my mind and I'm feeling excited about them, I wanted to write them in…

A Mechanism for Async Cancellation

One of the items on our Async 2027 Roadmap is to come up with some kind of asynchronous cleanup mechanism , like async Drop . There are some tricky design questions to making this work well, and we need to start thinking about these now if we want to have something ready by 2027. In this post, I'd like to explore a low level mechanism for how we might implement async cancellation. The goal is to…

Cancellation and Async State Machines

If you've been doing async for a while, you've probably heard someone say something like "the compiler takes an async function and converts it to a state machine." I want to dive into this more, since we can think of cancellation as making the state machine more complex. In this post, I'll show how to build a state machine for a simple async function. Then we'll we'll see how the state machine…