Skip to content

Combine channels/ports. Allow multiple receivers #2158

Closed

Description

@brson

Channels could combine the properties of channels and ports, be sendable types and allow multiple senders and receivers.

@pcwalton has suggested that this is what go does and it would seem to make channels more usable.

Likely requires copy constructors and a type that is both sendable and has destructors.

This is possibly at odds with #2157.

Activity

  1. graydon commented on Apr 10, 2012

    @graydon
    Contributor

    It's possible but I'm ... generally wary of this. Or at least ambivalent. Go is not the only language that does what it does, there are dozens of languages that experiment in this space. Rust's channels are half-duplex by design, following Erlang's lead. Making them full duplex means:

    • reduced implementation leeway; you have fewer options on how to implement / optimize. It pretty much has to be an atomically refcounted deque with a lock on its body.
    • increased inter-task synchronization on all operations; fewer chances to get the locks out of the path
    • less clear ownership of in-flight data
    • channels no longer weak, more stuff accidentally kept alive
    • a dead consumer task no longer means data drops on the floor; it buffers forever instead

    Possibly the ownership and buffer/drop (and sync/async) issues can be addressed with a richer channel API. I'm not sure the implementation flexibility or performance issues can be.

  2. brson commented on Jul 31, 2012

    @brson
    ContributorAuthor

    This is not the direction we are going. Closing.

  3. added a commit that references this issue on Sep 22, 2022
  4. added a commit that references this issue on Jul 8, 2026
  5. added a commit that references this issue on Aug 21, 2026
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

    A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsC-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions