- From: Adam Rice <notifications@github.com>
- Date: Tue, 24 Sep 2019 01:35:07 -0700
- To: heycam/webidl <webidl@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 24 September 2019 08:35:29 UTC
> However, this was not implemented anywhere yet, so maybe we should instead have Web IDL generate a values() method. That is my current thinking. Agreed (unless we find someone has implemented `getIterator()` already). > My initial leaning is to generate them (and in this way), as otherwise they're the odd iterator out. If we do, I'd much prefer to follow the array/value sync iterator precedent and have the keys be 0-based indices, instead of having them just be aliases of the values. Streams are not indexable, so returning indices would not be useful for anything. https://heycam.github.io/webidl/#idl-iterable says "A value iterator must only be declared on an interface that supports indexed properties." But a stream is not that kind of thing at all: for one thing, it does not (and cannot) have a `length` property. My conclusion is that we should *not* support `keys()` and `entries()` because they imply semantics which streams do not have. > Should we generate a forEach() function? I would argue "no", since we want to encourage the `for await ... of` syntax instead. -- 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/800#issuecomment-534454443
Received on Tuesday, 24 September 2019 08:35:29 UTC