yutakahirano / fetch-with-streams

Fetch API integrated with Streams.
66 stars 8 forks source link

Rename ReadableByteStream to ReadableStream. Add a note. #50

Closed yutakahirano closed 9 years ago

yutakahirano commented 9 years ago

For #46.

yutakahirano commented 9 years ago

@annevk, @domenic, can you take a look?

annevk commented 9 years ago

So I think some of this needs to move to IDL, since otherwise it doesn't work technically. You can't really mix operations on IDL objects and JavaScript objects freely like that.

Otherwise this seems fine. The harder aspect is when the stream is controlled by the developer.

yutakahirano commented 9 years ago

Fixed IDL.

I think some of this needs to move to IDL, since otherwise it doesn't work technically. You can't really mix operations on IDL objects and JavaScript objects freely like that.

Sorry I don't understand. Can you give an example?

annevk commented 9 years ago

What we return is an IDL ReadableStream. What JavaScript sees is a JavaScript ReadableStream. IDL needs to be updated to handle this. I filed https://www.w3.org/Bugs/Public/show_bug.cgi?id=28988 a while ago to get this added by the way.

(To even use ReadableStream in IDL, it needs to be listed there.)

yutakahirano commented 9 years ago

Thanks.

Then operations such as construction, en-queuing, closing, etc. will be defined in WebIDL, right? Will dependency to the Streams spec be replaced by dependency to WebIDL?

annevk commented 9 years ago

Yeah, sounds about right.

domenic commented 9 years ago

This seems good but I think we should add a note about ReadableStream vs. ReadableByteStream as I kind of said in #46. I will try to draft such a note later.

Then operations such as construction, en-queuing, closing, etc. will be defined in WebIDL, right? Will dependency to the Streams spec be replaced by dependency to WebIDL?

This seems kind of sucky. Web IDL should not need to be updated in such close tandem with the operations on streams. My preference would be, from most preferable to least:

The additions to Web IDL should be minor. I am thinking just the two type conversion rules.

Also, I do think maybe streams should incorporate the "to construct a fixed ReadableStream" or "to construct an empty ReadableStream." I can try to move those over to streams. They would operate on JS objects by default though.

annevk commented 9 years ago

With JavaScript, IDL had to take care of all the conversions. Now we define JavaScript features outside of JavaScript, perhaps both could carry some weight as you suggest. I would prefer us to be formally correct, but I'm okay with short term hacks.

yutakahirano commented 9 years ago

Thanks, @domenic, I added description about Readable[Byte]Stream.

I filed a new issue #52 for ReadableStream distinction.

yutakahirano commented 9 years ago

Thanks!