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

Clarify forwarding next() argument to non-1:1 combinators in explainer #106

Closed
shicks opened this issue Jun 26, 2020 · 1 comment · Fixed by #194
Closed

Clarify forwarding next() argument to non-1:1 combinators in explainer #106

shicks opened this issue Jun 26, 2020 · 1 comment · Fixed by #194

Comments

@shicks
Copy link

shicks commented Jun 26, 2020

My understanding is that the argument to next() is forwarded to the underlying iterator. All the examples of this are with 1:1 combinators, like map() where each call to next() on the mapped iterator corresponds to a single call to next() on the underlying iterator. It's not at all clear from the explainer what the behavior is for combinators where a single next() call on the result iterator may correspond to multiple calls to next() on the underlying iterator, such as filter() and drop(). Conversely, for flatMap(), many calls to the result iterator can correspond to a single call to the underlying iterator, so it's worth clarifying this behavior as well.

My reading of the spec was that it filter passes the same value repeatedly, drop passes undefined repeatedly (since it only skips on the first call), and flatMap doesn't attempt to pass the protocol at all, but it took me a few hours of staring at the different parts of the spec to figure that out.

@codehag
Copy link
Collaborator

codehag commented Aug 18, 2021

This may be related to/ solved by #122

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants