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

Should the "set up" algorithm for IDL-created WritableStreams wrap the write algorithm? #1253

Open
saschanaz opened this issue Jan 30, 2023 · 1 comment

Comments

@saschanaz
Copy link
Member

saschanaz commented Jan 30, 2023

Currently it wraps all others except the write one:

https://streams.spec.whatwg.org/#writablestream-set-up

Perform ! SetUpWritableStreamDefaultController(stream, controller, startAlgorithm, writeAlgorithm, closeAlgorithmWrapper, abortAlgorithmWrapper, highWaterMark, sizeAlgorithm).

Perhaps because writeAlgorithm is required here and others are optional, but then TransformStream does wrap the transform algorithm.

https://streams.spec.whatwg.org/#transformstream-set-up

Let transformAlgorithmWrapper be an algorithm that runs these steps given a value chunk:

Should WritableStream do the same?

@ricea
Copy link
Collaborator

ricea commented Feb 1, 2023

That's an interesting observation. I can justify it after-the-fact by saying that a writeAlgorithm should always return a promise in order to correctly support backpressure. On the other hand, none of the platform transforms I've defined return an unsettled promise.

Probably there is simply no need to wrap it? If there are two or more standards that always return a settled promise then it might we worth doing so that they could be more concise.

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

No branches or pull requests

2 participants