-
Notifications
You must be signed in to change notification settings - Fork 26
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
{ readableStream, writableStream } should be { readable, writable } #40
{ readableStream, writableStream } should be { readable, writable } #40
Comments
An early version of the API had them named {readable,writable}, but the feedback we got was that it was a bad idea to have those names precisely because it could be confused with a TransformStream. |
Not just transform streams use { readable, writable }; all "duplex streams" (i.e., all pairs of streams) do. I can add some more specific "must" guidance to the Streams Standard if that would be helpful in moving this issue forward. |
Reopening to continue the discussion. |
I was the source of the feedback mentioned above, and my concern was that it could be very hard to reason about the correct way to use the streams. Adding a 'Stream' suffix isn't inherently more clear though, it just prevents that specific mistake and encourages users to look at the documentation. I don't know if you are considering more substantial changes, like for example inverting the relationship to be a method that takes a Transformer and sets up the pipes for you. |
pipeThrough() on this object would create a loop, so pipeThrough() not working is a feature. This API is exposing what's effectively a pipeline insertion point, not a duplex channel. |
That's a good explanation, and it would have been useful if it were in the spec or explainer. Regardless, it's still ideal for readable/writable pairs to use uniform naming, instead of some of them having arbitrary redundant "-Stream" suffixes. |
We're going for the readable/writable name for consistency with other stream pairs. |
Thank you very much! I'll work on getting the Streams spec updated with stronger guidance. |
https://htmlpreview.github.io/?https://github.com/w3c/webrtc-insertable-streams/blob/master/index.html#dictdef-rtcinsertablestreams
The conventional names for a pair of readable and writable streams are
{ readable, writable }
, with no suffix. Aligning these will improve interoperability with the rest of the streams ecosystem, both concretely (e.g., making the object usable withpipeThrough()
) and just in terms of web developer familiarity.The text was updated successfully, but these errors were encountered: