Skip to content

Documentation of Lwt_stream.create and Lwt_stream.get #990

Open
@ezal

Description

It seems that pushing None to a stream closes the stream. I think this not said, and it could be said in the doc-string for create which creates the push function with type 'a option -> unit and it is not clear why option is used.

Related to this, the documentation for get is:

(** [get st] removes and returns the first element of the stream, if
    any. *)

This implies that if the stream is empty, then None is returned immediately (as a fulfilled promise).

But, AFAIU, that's not the semantics of get. If the stream is empty, get "blocks" until either a value v is available, in which case Some v is "returned". And get "returns" None if the stream is closed.

I can do a PR if I'm not wrong about the above.

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