-
Notifications
You must be signed in to change notification settings - Fork 161
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
Use async iterable
webidl type in ReadableStream.from
#1310
base: main
Are you sure you want to change the base?
Use async iterable
webidl type in ReadableStream.from
#1310
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good so far! 👍
Once the Web IDL spec change lands, we'll need to update webidl2js to implement the new algorithms for async iterables, and then we can update our reference implementation. Let's keep this PR as a draft until that's sorted out.
@MattiasBuelens Updated! I am planning to submit a PR to EDIT: PR for webidl2.js: w3c/webidl2.js#775 |
Moving over the question of whether this API should support The question posed is, "Should I think there are three possible outcomes here:
The current behaviour of the spec is option 2. Option 1 would be a more significant breaking change than option 3, but both are unlikely to have web compat issues. I say this because a) If we want to support passing strings, option 3 would likely be faster than option 2, because of the lower number of enqueue operations, string allocations, and object allocations involved. It would also mirror the behaviour of On the other hand, if we do not support strings at all (option 1), users would never be suprised by the choice we made between 1 and 2. Instead, they always get an explicit error that they can then deal with themselves. Both options are still trivially expressible using minimal changes by the developer. If they wanted to emulate the behaviour of option 2, they can do My preference is to option 1, followed by option 2 (if we want to support strings at all). I acknowledge that there would then be divergence between |
My preference is also for option 1. |
Mozilla has no use counter for string case. I can't imagine the use case either, but might be worth checking first. |
@ricea @saschanaz can we take your comments to count as implementer interest for this change? That would also unblock the IDL change. |
Yes, you can consider Blink interested. |
Also LGTM for stream change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still LGTM, with one small nit.
@@ -2123,43 +2123,27 @@ The following abstract operations operate on {{ReadableStream}} instances at a h | |||
</div> | |||
|
|||
<div algorithm> | |||
<dfn abstract-op lt="ReadableStreamFromIterable" id="readable-stream-from-iterable"> | |||
<dfn abstract-op export lt="ReadableStreamFromIterable" id="readable-stream-from-iterable"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why export, btw?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will be needed to resolve whatwg/fetch#1291, which is my next project :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case you would want a separate op in section 9, this one is in section 4 and not supposed to be directly used by other specs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, will revert this here
Ref whatwg/webidl#1397
(See WHATWG Working Mode: Changes for more details.)
Preview | Diff