Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation of Lwt_stream.create and Lwt_stream.get #990

Open
ezal opened this issue May 4, 2023 · 0 comments
Open

Documentation of Lwt_stream.create and Lwt_stream.get #990

ezal opened this issue May 4, 2023 · 0 comments

Comments

@ezal
Copy link

ezal commented May 4, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant