Skip to content

§14.10: the select await examples print rx.recv() as T, but recv returns Option[T] #3021

Closed

Description

@ehartford

Spec §14.10 (014_concurrency.md) shows

select await
    msg = rx_fast.recv() => print(f"fast: {msg}")
    msg = rx_slow.recv() => print(f"slow: {msg}")

and the §14.10 loop examples bind msg = inbox.recv() and pass it straight to process(msg). Receiver.recv returns Option[T] (lib/std/channel.w: "None once closed and drained"), so under #2956 (merged, #3018) the arm binding is Option[T] and printing it as written gives Some(7); the fixtures write msg.unwrap().

Either the examples are loose and should read Some(msg) = rx.recv() / msg.unwrap(), or the spec means recv to yield T with a separate closed-channel story (a closed channel ending the select arm, or recv on a closed channel being an error the arm pattern handles). A spec question for Eric; fixtures should not settle it. Related: #2955 item 1 (timeout does not exist).

Activity

  1. added a commit that references this issue on Nov 6, 2026
  2. ehartford commented on Nov 6, 2026

    @ehartford
    ContributorAuthor

    Fixed in #3055 (docs-only, blessed by Eric 2026-11-06).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions