Re: [streams] Byte stream update, including reference implementation (#361)

> +    return new ReadableByteStreamReader(this);
> +  }
> +}
> +
> +class ReadableByteStreamController {
> +  constructor(controlledReadableByteStream, underlyingByteSource) {
> +    if (IsReadableByteStream(controlledReadableByteStream) === false) {
> +      throw new TypeError('ReadableByteStreamController can only be constructed with a ReadableByteStream instance');
> +    }
> +
> +    if (controlledReadableByteStream._controller !== undefined) {
> +      throw new TypeError(
> +          'ReadableByteStreamController instances can only be created by the ReadableByteStream constructor');
> +    }
> +
> +    const pullFunction = underlyingByteSource['pull'];

I prefer letting these fail at call time instead of immediately. The values could change over time and this kind of aggressive type checking is unnecessary.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/361/files#r32264727

Received on Thursday, 11 June 2015 20:32:19 UTC