Re: [whatwg/encoding] Add Streams support (#72)

Regarding locking, to me the question is whether we want to say that either API is layered on top of the other, or whether they are two separate APIs that just happen to share the same object.

If we say that the `dec.decode()` API is layered on top of the `dec.readable` / `dec.writable` API, we'd write it something like

```js
TextDecoder.prototype.decode = function (input, options) {
  const writer = this.writable.getWriter();
  const reader = this.readable.getReader();
  
  this.writer.write(input);
  const output = this.reader._readSync(); // private API I guess
  
  writer.releaseLock();
  reader.releaseLock();
  
  return output;
};
```

In this case the code in https://github.com/whatwg/encoding/issues/72#issuecomment-278578675 seems fine to me, nondeterminism included.

Am I missing something?

-- 
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-363162233

Received on Monday, 5 February 2018 17:45:23 UTC