Skip to content

Feature request: Stream select #577

Open
@dermesser

Description

@dermesser

Thank you very much for your work on eio! I've thoroughly enjoyed working with it, despite being a newcomer to OCaml. Eio feels more advanced than the async frameworks in other languages I've used.

So far, I have been missing one feature: Waiting on multiple streams, which in languages like Go or Rust is called select. I've taken a look at the source code, but as a newbie I didn't want to charge ahead with some untenable solution (and besides, any possible implementation appeared non-trivial to me).

I don't have a specific API in mind, but something simple like

val select : ('a Stream.t * ('a -> 'b)) list -> 'b

to select between different channels producing items of the same type and permitting per-stream handling, or

val select2 : 'a Stream.t -> 'b Stream.t -> ('a, 'b) Either.t

for selecting between exactly two streams may already prove to be useful. I'd love to hear what you think.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions