Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

don't preserve the generator protocol for helper-produced iterators #194

Merged
merged 4 commits into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,17 @@ const wrapper = Iterator.from(iter);
wrapper.next() // { value: 1, done: false }
```

## Iterator helpers and the generator protocol

The generator protocol facilitates coordination between a producer and a
consumer, which is necessarily broken by iteration-based transforms. There is
no way to properly preserve or re-establish this coordination. We've taken the
philosophy that any iterators produced by the helpers this proposal adds only
implement the iterator protocol and make no attempt to support generators which
use the remainder of the generator protocol. Specifically, such iterators do
not implement `.throw` and do not forward the parameter of `.next` or `.return`
to an underlying or "source" iterator.

## More Example Usage

### Lazy Iteration over sets
Expand Down
Loading