Re: [whatwg/streams] Editorial: add cross-links to internal slots (#1050)

> If we start using mixins for something like this... will we also want to use them for controllers? A lot of internal slots and public APIs are shared between the two readable stream controllers. And heck, maybe more abstract ops would be shared, if we had a common place to share them. (Not sure about that one.)

I suppose we could share some code between `SetUpReadableStreamDefaultController()` and `SetUpReadableByteStreamController()`. The properties and methods (`desiredSize`, `close`, `enqueue`, and `error`) all use different abstract ops, and while they do share a similar structure, they call into different ops like `ReadableStreamDefaultControllerShouldCallPull` and `ReadableByteStreamControllerShouldCallPull`. We could try using polymorphism for that, but I'm afraid it would get weird... 😕 

> I also worry a bit about the impact on spec readability of splitting readers out so that you have to read at least 2 sections per reader, instead of 1. This is most stark for the domintro sections, aimed at web developers; would we split those up?

In the Encoding spec, the domintro section about the `encoding` getter is repeated for [`TextDecoder`](https://encoding.spec.whatwg.org/#ref-for-dom-textdecoder-encoding%E2%91%A0) and [`TextDecoderStream`](https://encoding.spec.whatwg.org/#ref-for-dom-textdecoder-encoding%E2%91%A1). The links inside those sections do link back to `TextDecoderCommon.encoding`, though.

I think we could do the same: keep the domintro sections for `ReadableStreamDefaultReader` and `ReadableStreamBYOBReader`, but link to the definitions in `ReadableStreamGenericReader`.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/1050#issuecomment-670714025

Received on Friday, 7 August 2020 21:08:44 UTC