Patterns & Abstractions

submited by
Style Pass
2023-03-15 13:00:01

This is the second post in an informal series commenting on the design of async Rust in 2023. In my previous post, after a discussion of the “registers” in which control-flow effects could be handled in Rust, I promised to turn my attention to recent proposals around a concept called “keyword generics.” For reference, there are two posts by the current design team of Rust that are my reference point for this commentary:

I’m not going to reiterate these blog posts at length, but in brief “keyword generics” is a proposal to introduce a new kind of abstraction to Rust, to allow types to be abstracted over certain effects. The examples have focused on async and const as the effects, but there is sometimes discussion of try as well. Astute readers will notice this is an overlapping but not identical set of effects to the effects I identified in my last post; I did not mention const as an effect, and as far as I know the keyword generics working group has not devoted much or any time to considering iteration as an effect.

It’s also important to note that two different versions of this proposal are present in these posts: in one, users can abstract over the presence or absence of a specific effect (e.g. ?async), in the more advanced form, users can abstract over the presence or absence of arbitrary effects (i.e. ?effect).

Leave a Comment