- From: Domenic Denicola <notifications@github.com>
- Date: Wed, 07 Feb 2018 04:11:16 +0000 (UTC)
- To: whatwg/encoding <encoding@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/encoding/issues/72/363651543@github.com>
> The non-determinism creates a footgun which in my opinion means we should strongly discourage mixing the APIs. I mean, this seems like any other case where you use both a high-level API and a low-level API together to operate on the same underlying data. The interactions will be subtle and perhaps unpredictable. But you can get nondeterminism when using streams in lots of ways. E.g. the code feels analogous to ``` let dec = new TransformStream(); let writer = dec.writable.getWriter(); writer.write(chunk1); await doSomethingWith(dec.readable); writer = dec.writable.getWriter(); writer.write(chunk2); let reader = dec.readable.getReader(); let what = await dec.reader.read(); ``` To be clear, here the contents of `what` depend on whether `doSomethingWith` read from `readable` or not. (If it did, `what` is `chunk2`; if it did not, `what` is `chunk1`.) I'm not sure why we're concerned about https://github.com/whatwg/encoding/issues/72#issuecomment-278578675, but not concerned about the above. > I'm also skeptical of explaining the behaviour of decode() in terms of a fictional synchronous streams API. I feel it doesn't mesh well with the very concrete way that Encoding and Streams are specified. I guess I was more getting at the idea that they both could conceptually operate on the same underlying stream queues. As opposed to them being completely separate, but occupying the same object. I wasn't proposing actually adding a sync API. -- 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/encoding/issues/72#issuecomment-363651543
Received on Wednesday, 7 February 2018 04:11:42 UTC