--- title: WG-async open discussion 2023-11-09 tags: WG-async, open-discussion, minutes date: 2023-11-09 discussion: https://rust-lang.zulipchat.com/#narrow/stream/187312-wg-async url: https://hackmd.io/P6WWnfHvSeeE-Kyp-pp33A --- # Open discussion: November 2023 This is the doc for open discussion within wg-async about various design questions and other topics. Please feel free to propose a topic below. On the day of the meeting, we'll do a quick poll to sort the topics by interest and then go through them one by one. If you have a brief (under 5 min) introduction prepared for the group, we'll take that into account as we prioritize the topics. Attendance: TC, tmandry, yosh, eholk Leave discussion topics below. --- ## Roadmap pre-planning TC: We wanted to enumerate the candidate roadmap items. yosh: I have a sketch about what "completing" the story would look like. <img src="https://hackmd.io/_uploads/ryW0-9q7p.jpg" width="300px"> ## Big list * Maybe Async (Trait Definitions) * AsyncIterator - `poll` vs `async fn next` * AsyncFnNext * Async Generators * Async Drop - Prototype from eholk: https://theincredibleholk.org/blog/2023/11/08/cancellation-async-state-machines/ (This post has no code, it's just some background for a forthcoming post that will have code) - yosh: https://blog.yoshuawuyts.com/tree-structured-concurrency/ - tmandry: https://tmandry.gitlab.io/blog/posts/2023-03-01-scoped-tasks/ - boats: https://without.boats/blog/the-scoped-task-trilemma/ - boats: https://without.boats/blog/changing-the-rules-of-rust/ - boats: https://without.boats/blog/follow-up-to-changing-the-rules-of-rust/ - boats: https://without.boats/blog/generic-trait-methods-and-new-auto-traits/ - niko: https://github.com/nikomatsakis/moro/ - yosh: https://hackmd.io/KqASjHfBR6am3z5INtKCJA * Async Cancellation * Async Closures * Finishing AFIT: RTN * Finishing AFIT: Dyn dispatch * TAIT * Concurrency and Parallelism * Executor/Spawn traits (portability) * Static concurrency primitives * Dynamic concurrency primitives * Organizational - checkboxes for wg-async, what's our relationship to other teams, etc. * Start stabilizing parts of [futures-concurrency](https://docs.rs/futures-concurrency) * Starting with: `impl IntoFuture for {Vec, Array, Tuple}` * 2024 Edition changes * Future, IntoFuture in prelude ```mermaid flowchart LR MaybeAsync["Maybe Async (Trait Definitions)"] MaybeAsyncInStd["Using MaybeAsync in traits in std"] AsyncIterator["AsyncIterator"] AsyncFnNext["async fn next"] AsyncDrop["Async Drop"] AsyncCancellation["Async Cancellation"] AsyncGenerators["Async Generators"] AsyncClosures["Async Closures"] BecomingTeam["Becoming a Team"] RTN["Return Type Notation"] AFITDyn["Dyn dispatch for AFIT"] ExecutorSpawn["Executor/Spawn traits"] TAIT["Type alias impl Trait"] FuturesConcurrency["futures-concurrency"] ForAwait["for await syntax"] AsyncSocketsAPI["Async sockets API"] AsyncFileAPI["Async file API"] DefaultAsyncRuntime["Default async runtime"] AsyncMain["async fn main and #[test]"] AsyncScopedTasks["Async scoped tasks"] StructuredConcurrency["Structured concurrency"] StructuredParallelism["Structured parallelism"] Combinators2["Combinators 2.0"] ProtocolPortability["Portability for protocol implementations"] IouringSupport["Support for iouring"] AsyncRead["AsyncRead, AsyncWrite, AsyncBufRead, etc."] MaybeAsyncInStd -->|dep| MaybeAsync AsyncIterator -->|dep| MaybeAsync AsyncIterator -->|maybe dep| AsyncFnNext AsyncFnNext -->|dep| TAIT FuturesConcurrency -->|dep| AsyncIterator AsyncCancellation -->|dep| AsyncDrop ``` Project board: https://github.com/orgs/rust-lang/projects/28 Recent blog post from boats: https://without.boats/blog/a-four-year-plan/ ## High-level goals What problems need solved? TC: What Niko has written recently about how to approach this: https://smallcultfollowing.com/babysteps/blog/2023/10/20/using-rust/ * People can't write things they want to write * People have to use external crates for things that should be in std * Ecosystem crates can't interoperate well because we don't have foundations in std * Async is too hard? In what ways? * Portability for protocols * Expressiveness gaps * Where we define expressiveness as "the ability to express something at all", at least without going to extraordinary lengths ## Big questions * How do we integrate async traits into std? * Maybe Async trait definitions * "Do we call it `AsyncIterator` or `async Iterator`" * I/O Traits * Should async, sync be the same * Definitely possible to have convergent APIs (async-std) * But Tokio has diverged (partly in ways that aren't specific to async) * https://yoshuawuyts.notion.site/yoshuawuyts/a644246eada64ebab4163fec8a1141e7?v=10b1a319e9d04f5c87cf44849810f281 - catalogues which traits could be made maybe-async, maybe-const, maybe-try, etc. * Structured concurrency: What it depends on * async drop, maybe (The meeting ended here.)