[whatwg/streams] pipeTo says "in parallel", but that isn't really right (#905)

(Previously briefly discussed in #902.)

The [current pipeTo() spec](https://streams.spec.whatwg.org/commit-snapshots/8e99a69dbbb6755ce6d0c1928fdf6ad7dcebfd0f/#rs-pipe-to) says to run the reading/writing stuff "in parallel", i.e. on a background thread. This is wrong, mainly because of the case of developer-created streams, where reading and writing necessarily means running JS code.

The _intent_ here is to not block the main thread while reading/writing. This is generally not possible in the spec if you use the existing read/write operations, as those all return promises. But, we wanted to allow some flexibility in the unobservable cases, so we just used vague "reading and writing", and from there my shortcut for saying "don't block" was "do this in parallel". This has other subpar consequences; see #618 and #728.

Currently I am thinking we want to more clearly suggest that you use the spec's existing read/write operations, and clarify what is and isn't observable. (Is: calling into JS-created underlying sources/sinks. Isn't: a bunch of other stuff.)

I'm not sure exactly how we should phrase things here, and whether it'll cover all task queuing/non-blocking/realm related stuff, but I'll try to give it a shot. In the meantime, I want this issue as documentation of a known problem, which we can link to in the spec.

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

Received on Friday, 9 March 2018 02:45:52 UTC