[whatwg/streams] Make it easy to create streams with no underlying source/sink/transformer objects (#813)

I had an epiphany while reading https://github.com/whatwg/streams/pull/811. We don't necessarily need to block that on solving this, but I wanted to record it.

Once https://github.com/whatwg/streams/issues/691 is fixed, we'll have a slot in the classes for the appropriate functions from the underlying source/sink/transformer. We should take this a step further, and have the slot store "algorithm steps" instead of JavaScript functions.

For the constructor-generated instances of each class, we'd store algorithm steps that are just `Call(func, ...)` basically. But this would allow us to easily create instances of streams with specific algorithm steps from specs without indirecting through JavaScript objects and classes. For example it would simplify https://fetch.spec.whatwg.org/#concept-construct-readablestream .

Maybe we'd even abstract out the promise-stuff too so those steps don't have to return promises.

This is related to https://github.com/whatwg/streams/issues/372#issuecomment-237456743 .

-- 
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/issues/813

Received on Thursday, 28 September 2017 17:09:33 UTC