Re: [heycam/webidl] ReadableStream IDL type (#445)

The [WebTransport spec](https://w3c.github.io/webtransport/#idl-index) is full of WebIDL with comments like this one (third line):
```webidl
interface mixin UnidirectionalStreamsTransport {
  Promise<SendStream> createUnidirectionalStream(optional SendStreamParameters parameters = {});
  /* a ReadableStream of ReceiveStream objects */
  readonly attribute ReadableStream incomingUnidirectionalStreams;
};
```
Without this comment, it'd be hard to reason about what `incomingUnidirectionalStreams` gives you.

I think `ReadableStream` and `WritableStream` deserve the same treatment as `Promise` here:
```webidl
interface mixin UnidirectionalStreamsTransport {
  Promise<SendStream> createUnidirectionalStream(optional SendStreamParameters parameters = {});
  readonly attribute ReadableStream<ReceiveStream> incomingUnidirectionalStreams;
};
```

This would follow a tradition of making I/O types part of an API's code signature, helping readers reason about call sites.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/445#issuecomment-764679313

Received on Thursday, 21 January 2021 14:29:18 UTC