[whatwg/streams] WIP: allow creating streams from specs while using fewer JS objects (#857)

This is a start at addressing #813. Task list:

- [x] Add CreateReadableStream(pullAlgorithm, cancelAlgorithm, sizeAlgorithm, highWaterMark)
- [x] Update TeeReadableStream to use it
- [ ] Consider making pullAlgorithm and cancelAlgorithm optional so as to better match [fetch](https://fetch.spec.whatwg.org/#concept-construct-readablestream)
- [ ] Update writable streams analogously
- [ ] Update transform streams to use the two above
- [ ] Update readable byte streams analogously
- [ ] Update web platform tests for the change in the .length of the controller constructors

One thing that slightly regressed is that a lot of the controller-specific logic has moved back into the ReadableStream constructor. The thinking I currently have is that the ReadableStream constructor is responsible for turning incoming JS objects into their most abstract forms: algorithms + numbers, all validated and normalized. Unfortunately this validation/normalization branches depending on whether it's a byte stream or not. This may be fixable by just creating extra abstract ops and shuffling them off into the right section, I guess, but for now I've just created a bigger ReadableStream constructor.

I'd appreciate help on the above task list while I'm asleep, if people have free time :)
You can view, comment on, or merge this pull request online at:

  https://github.com/whatwg/streams/pull/857

-- Commit Summary --

  * Editorial: alphabetize ReadableByteStreamController slots list
  * Editorial: change slots for readable controller brand checks
  * Allow creating ReadableStreamDefaultControllers from algorithms
  * Allow creating ReadableStreams from algorithms
  * Consolidate creation of ReadableStreamDefaultControllers
  * Make it possible to use algorithms for size as well
  * Update the model sections to specify web developer–created streams

-- File Changes --

    M index.bs (337)
    M reference-implementation/lib/readable-stream.js (340)

-- Patch Links --

https://github.com/whatwg/streams/pull/857.patch
https://github.com/whatwg/streams/pull/857.diff

-- 
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/857

Received on Thursday, 16 November 2017 23:04:08 UTC